sebastiandaschner news
Hi from approx. 30.000 feet above Europe! I’m flying to the Øredev conference right now — the third Swedish conference for me this year :-)
The last days were also full of traveling. I’ve attended the Joker conference in Saint Petersburg, Russia and I can say I absolutely enjoyed the time there. I did two sessions, about the CQRS principle with Java, and 12-factor, cloud native Java EE. The attendees of the conference were very experienced and asked a lot of well-founded questions. After every session, the attendees were asked to follow the speaker into so-called discussion zones, where they could ask any technical question and “grill” the speaker :-) That was a lot of fun! I was happy that I could share some knowledge and see a lot of enthusiasm about the Java platform. The city of Saint Petersburg offers a lot of history and stunning architecture. I will definitely try to come back to Joker.
I was honored to be interviewed by Adam Bien himself, as part of his airhacks.fm podcast. We had a chat about Java EE, EE4J, JavaOne and why I was crazy enough to write a book :-) I enjoyed giving that interview and I hope you’ll enjoy listening to it.
In the next weeks it will be more client workshops about Java, Docker, Kubernetes and OpenShift for me. I’m already looking forward to teach about these technologies again.
The plannings for the jSpirit unconference advance more and more. We will organize a HackerGarten as part of the unconference. I hope I can see a few of you at the first jSpirit! Please visit the registration page if you want to participate.
What’s new
JPA 2.2 repeatable annotations
In order to align JPA 2.2 with Java SE 8, repeatable annotations have been added.
Now multiple definitions such as @JoinColumn
or @NamedQuery
do not have to be wrapped into a grouping annotation anymore.
For example, instead of wrapping named query definitions into @NamedQueries
, we can define them inline now:
@Entity
@NamedQuery(name = FIND_ALL, query = "select c from Customer c")
@NamedQuery(name = FIND_ACTIVE, query = "select c from Customer c where c.active = true")
public class Customer {
...
}
This is a small improvement that still makes Java EE code a bit leaner.
JPA 2.2 annotations that are considered as repeatable are, among others: @Convert
, @JoinColumn
, @MapKeyJoinColum
, @NamedEntityGraph
, @NamedQuery
, @NamedStoredProcedureQuery
, @PersistenceContext
, @PrimaryKeyJoinColumn
.
Try-finally for shell scripts
You can make your shell scripts more robust by adding so-called traps. Traps are functions that are called on certain script exit codes that usually clean up created resources.
#!/bin/bash set -eu trap cleanup EXIT cleanup() { echo "stopping test-container" docker stop test-container docker rm test-container } docker run -d \ --name test-container \ my-test-container:1 echo "doing something with test-container"
Calling the script will run a test-container
and stop it once the script stopped — no matter whether the overall script execution was successful.
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.