The week in Java

Java Weekly 35/15: Patterns, Caching, Hibernate and JSON-P

Thorben Janssen
News image via Shutterstock

Another edition of Java news by Thorben Janssen features Java Design Patters, lambda memoization in Java 8, and caching to round it all up. All this and more when checking out the week’s hottest Java links.

This post originally appeared on Thorben Janssen’s Java EE blog, where Java news is published weekly:

Using the right design patterns can speed-up the design and development phase of a project and help to avoid common but subtle problems. If you want to get an overview about common design patterns or check how to implement a specific one in Java, have a look at Ilkka Seppälä’s Java Design Patterns page. It lists 56 popular design patterns with a short description, a class diagram and example code for each of them.

The jOOQ team wrote a nice post about the usage of null and Optional in the JDK API and what it means to introduce Optional to your own APIs. They proclaim that this is an all or nothing decision. You either use Optional or null, but never both. What is your opinion on it?

Dominic Fox wrote an interesting post about Lambda memoization in Java 8 in which he shows an easy way to store the results of expensive functions in memory.

Java EE

The different CDI interceptors provided by the JCache specification make caching really simple. Romain Manni-Bucau shows in his recent post (@CacheResult: JCache + CDI to the rescue of microservices?) the basic usage of the @CacheResult annotation and dives deeper into topics like customising the cache interactions, caching Exceptions and using scheduled methods to update the cache.

JPA 2.1 fixed the missing support for stored procedure calls by adding @NamedStoredProcedureQuery. The post, How to call stored procedures in JPA, provides a detailed description on how to use this annotation to define a stored procedure call and how to handle the different types of input and output parameters.

The Hibernate team have published the Hibernate ORM 5.0 release. The most interesting changes are out of the box support for the Java 8 Date and Time API, the addition of Hibernate Spatial and massively improved support for attribute converters.

Check out How to implement a JPA Attribute Converter to learn more about the implementation and different usage scenarios of attribute converters.

Java EE 8

At the beginning of this month, the JSON-P 1.1 expert group released their early draft release of the specification update. Hakan Özler had a look at it and describes new features like JSON Patch, JSON Pointer and JSON Merge Patch in First Look at JSR 374, JSON-P 1.1 EDR.

This and that

Trisha Gee writes an interesting series about code reviews on the JetBrains blog. In her recent post, she gives some great tips on how to identify common misuses of data structures like Lists and Maps and which ones to use instead: What to look for in a Code Review: Data Structures.

And if you haven’t already done that, make sure to have a look at the other parts of her series. They are definitely worth your time!


If you missed last weeks vJUG session “Java concurreny under the hood” by Gleb Smirnov, you can (and should) watch it on the vJUG website.

Thorben Janssen
Thorben is a senior developer and regular Java blogger with more than 10 years of experience in Java EE development and architecture. During these years he has acted as developer, architect, project and technical lead to create high available, clustered mobile billing solutions and laboratory information management systems.

Leave a Reply

Your email address will not be published.