sebastiandaschner news

saturday, april 15, 2017

Welcome to the fourth newsletter!

In the last days it was more client work in Munich for me and now enjoying some quiet days over easter until there will be a lot of conferences again starting from next week. On monday I’ll be flying to Canada for Oracle Code Toronto and then directly off to London for another Oracle Code. I’m already looking forward to speak about the topic of CQRS (Command Query Responsibility Segregation) with Java EE.

Speaking of conferences: I was honored to be selected as a double JavaOne 2016 Rockstar speaker. Of course the obligatory tweet with the rocking Duke had to follow. Apparently the award is from the Museum of Modern Art — that I just visited when I was in New York.

Speaking of traveling: For May I can now announce that there will be another motorbike tour in Japan! Including JavaDay Tokyo, Oracle Code Tokyo, JJUG, driving around the whole country visiting Java User Groups and companies and of course a lot of Java, Java EE and Cloud Native content. Already looking forward to seeing Japan again. Maybe you’ve seen our Java Japan Tour last year — or seen the video on the JavaOne keynote — if not have a look at the OTN article. Although this year it’ll be even more content: We are organizing an unconference, held at a Japanese hot spring, a so-called Onsen: JOnsen. I’m super excited how things will work out — we already have a group of great Java luminaries from both Japan and abroad.

Besides that I’m also working a lot in the Cloud Native and Continuous Deployment area right now — how to use these best to improve Java Enterprise development. You can expect more topics, workshops and conference talks on Kubernetes, OpenShift, cloud and CD together with Java EE in the next time!


What’s new

Disclaimer for the last two: This is not to encourage you to use these things in your project’s code. Sometimes hacks like these are needed to deal with legacy code but in your normal life you want to refactor your code to make it testable. And these two won’t work in Java 9 either.


JAX-RS 2.1 update

JSR 370, specifying the next version of JAX-RS is moving faster than ever. The Expert Group decided to not fully support NIO features, because of API issues that would have been imcompatable or at least quite ugly when Java 9 arrives. However, I welcome these change of direction, since that would have meant introducing an imperfect API and now we can focus on smaller improvements that IMO make at least as much sense to be added to the spec. Support of the HTTP PATCH method is being built in right now and more improvements are to be tackled. Kudos to our Spec Lead, Pavel Bucek btw. — I think he’s doing a great job moving things forward.


JPA Persistence unit SQL scripts definition

You can define and link to SQL scripts in a JPA persistence context definition that will be executed at runtime. There are standardized properties to define scripts how to create the schema, bulk-load data and drop the schema, respectively:

<persistence version="2.1" xmlns=""
    <persistence-unit name="prod" transaction-type="JTA">

            <property name="javax.persistence.schema-generation.database.action"

            <property name="javax.persistence.schema-generation.create-script-source"
                    value="create-schema.sql" />

            <property name="javax.persistence.sql-load-script-source"
                    value="load-data.sql" />

            <property name="javax.persistence.schema-generation.drop-script-source"
                    value="drop-schema.sql" />


The SQL files are expected to reside in the classpath.


Advanced GitHub usage

Since most of us are using GitHub, here are some tips that help writing better and improving our workflow:

You can close GitHub issues directly in commit messages by linking to the issue number like fixed critical bug; resolves #123. See the GitHub help.

In encourage everyone to use formatting feature when writing issues and comment. Code can be formatted to monospace using 3 backticks — and even better, can be code-highlighted in your desired language by specifying the language name:

public class Hello {
    public void method() {
        // pretty-print this

Issues and PRs can be referenced by the number (#3 or sdaschner/jaxrs-analyzer#3), there is support for checkbox-based task lists - [ ] To be done and long stacktraces or debug messages can be folded away using <details>long text…​</details>.

Have a look at the GitHub help for writing.


Thanks a lot for reading and see you next time!


Did you like the content? You can subscribe to the newsletter for free:

All opinions are my own and do not reflect those of my employer or colleagues.