In my spare time I lead the MapStruct project, a code generator for bean to bean mappings.
Unless you’ve been living under a rock for the last months and years, you’ve probably heard about the efforts for adding a module system to the Java platform, code-named "Project Jigsaw".
Defining a module system and modularizing a huge system like the JDK is by no means a trivial task, so it’s not by surprise that the advent of Jigsaw has been delayed several times. But I think by now it’s a rather safe bet to expect Jigsaw to be released as part of JDK 9 eventually (the exact release date remains to be defined), especially since it became part of the early access builds a while ago.
This means that if you are an author of a library or framework, you should grab the latest JDK preview build and make sure your lib can be used a) on Java 9 and b) within modularized applications using Jigsaw.
[ ... ]
One of the things library developers often miss in Java are property literals. In this post I’m going to show how to make creative use of Java 8 method references to emulate property literals, with the help of some byte code generation.
Akin to class literals (e.g.
Customer.class), property literals would allow to refer to the properties of a bean class in a type-safe manner.
This would be useful for designing APIs that run actions on specific bean properties or apply some means of configuration to them.
E.g. consider the API for programmatic configuration of index mappings in Hibernate Search:
[ ... ]
"When running a full-text query with a projection of fields, is it possible to return the result as a list of POJOs rather than as a list of arrays of
The answer is: Yes, it is possible, result transformers are the right tool for this.
It’s my pleasure to announce the release of Hibernate Validator 5.2.4.Final!
This is a rather small bugfix release which addresses two nasty issues around one of the more advanced features of Bean Validation, redefined default group sequences.
It’s my pleasure to announce the release of Hibernate Validator 5.2.3.Final!
Wait, didn’t we already do another Hibernate Validator release earlier this month? That’s right, indeed we pushed out the first Alpha of the 5.3 family a couple of days ago. And normally, that’d mean that there would be no further releases of earlier version families.
But in this case we decided to do an exception from the rule as we noticed that Hibernate Validator couldn’t be used with Java 9 (check out issue HV-1048 if you are interested in the details). As we don’t want to keep integrators and users of Hibernate Validator from testing their own software on Java 9, we decided to fix that issue on the current stable release line (in fact we strongly encourage you to test your applications on Java 9 to learn as early as possible about any potential changes you might need to make).
It’s my pleasure to announce the first release of Hibernate Validator 5.3!
The overarching idea for the 5.3 timeline is to prototype several features which may potentially be standardized in the Bean Validation 2.0 specification. For instance we’ll work on a solution for the long-standing request for sorting the constraints on single properties.
If you’d like to see any specific features addressed in that prototyping work (and eventually included in BV 2.0), then please get in touch and let us know which are the most important things you are missing from the spec. We’ve compiled a first list of issues we are considering for inclusion in BV 2.0. For sure we cannot address all of them, so it’ll greatly help if you tell us what would be most helpful to you.
I am happy to announce the availability of Hibernate Validator 5.2.2.Final.
We also closed a gap in the API for constraint declaration which allows to ignore annotation-based constraints for specific methods, parameters etc.:
"Order, ooorder!" - Sometimes not only the honourable members of the House of Commons need to be called to order, but also the results of Hibernate Search queries need to be ordered in a specific way.
To do so, just pass a
Sort object to your full-text query before executing it, specifying the field(s) to sort on:
It’s my pleasure to announce the first Alpha release of Hibernate OGM 5!
This release is based on Hibernate ORM 5.0 Final which we released just last week.
The update should be smooth in general, but you should be prepared for some changes if you are bootstrapping Hibernate OGM manually through the Hibernate API and not via JPA.
If you are using Hibernate OGM on WildFly, you need to adapt your application to the changed module/slot name of the Hibernate OGM core module which has changed from
The other day I came across an interesting mapping challenge which I thought may be worth sharing. If you are a seasoned JPA user, it will probably be nothing new to you, but those not as experienced may find it helpful :)
TL;DR - JPA let’s you override database columns for embedded objects but also for collections of embedded objects;
@AssocationOverride can be used for that.
Let’s assume the following entity model representing a person and their home and business address:
[ ... ]