sebastiandaschner news


monday, october 09, 2017

Welcome to the thirteenth edition of my newsletter.

The last weeks were not only busy but more than busy. As mentioned last time, I joined AndrĂ©s Almiray, Ixchel Ruiz and Kirk Pepperdine on the Road to BaselOne — a Java tour through the middle of Europe. We enjoyed seeing a lot of Java enthusiasm in these countries — and too much Pizza ;-)

A lot is happening in the world of Java right now. Java SE 9 is final, Java EE 8 and GlassFish 5 has been released and the Java EE platform is about to be moved to the Eclipse Foundation as EE4J top level project. I personally like to think of the name EE4J as “Enterprise Edition for Java” (origin).

Last week was by far the busiest week of the whole year. I attended JavaOne 2017 — which was another awesome experience! It’s always exciting to come back to San Francisco. We had a super fun Matrix-themed Community Keynote. I was glad to play the chosen (Java) One — Neo :-) As soon as the recording is available, I will let you know. And I’m more than proud to announce that I finished my book, Architecting Modern Java EE Applications!

Right now I’m already back in Munich and holding a client workshop on Docker, Kubernetes and OpenShift.

 

What’s new

 

Architecting Modern Java EE Applications

I’m proud to announce that my book on Java EE 8 is available for pre-order. In order to explain the motivation and contents, I’ve recorded a video.

The book includes the following topics:

  • Pragmatic, business-oriented enterprise application architectures

  • Designing and implementing application modules using Java EE 8

  • Lightweight, zero-dependency applications, their motivations and benefits

  • Packaging and delivering applications using Docker and Kubernetes

  • Continuous Delivery pipelines, targeted for container environments

  • Testing enterprise applications in an automated way

  • Maintainable test scenarios with reasonable test code quality

  • Distributed systems and their motivations

  • Eventual consistency, event-driven architectures and CQRS

  • Tackling performance regression, monitoring and logging

  • Security in distributed systems

If you’re fast you can use the discount codes AMJEEASD10 and AMJEEASD40 until the end of October via the Packt website.

 

JPA 2.2 Date and Time support

Java EE 8 ships with JPA in version 2.2. That version mainly targets to include Java SE 8 features into the JPA API.

The Java SE 8 support includes the Date and Time API. Types such as LocalDate or LocalDateTime are now natively supported for entity properties. Developers don’t need to rely on vendor-specific features or workarounds anymore.

The following entity can now directly be persisted:

@Entity
@Table(name = "coffee_orders")
public class CoffeeOrder {

    @Id
    @GeneratedValue
    private Long id;

    @Basic(optional = false)
    @Enumerated(EnumType.STRING)
    private Type coffeeType;

    private LocalDateTime created;

    private LocalDateTime updated;

    // getters & setters
}

 

JPA 2.2 Stream result

JPA 2.2 makes it also possible to return a query result not only as List<T> but Stream<T>, using the getResultStream() method:

Stream<CoffeeOrder> coffeeOrders = entityManager
        .createNamedQuery(CoffeeOrder.FIND_UNFINISHED_ORDERS, CoffeeOrder.class)
        .getResultStream();
coffeeOrders.map(...)

This functionality comes in handy when developers want to immediatly transform the returned entities via Stream#map.

However, please don’t use this feature for filtering the results. Databases perform much better in executing SQL filter criteria directly.

 

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.