Today, we release the first candidate release of Hibernate ORM 5.4.0.
5.4 is the direct continuation of 5.3 and you should plan for an upgrade to continue getting fresh fixes as soon as the Final is released.
Please consider testing this candidate release so the upgrade can be as smooth as possible.
What’s new
EntityGraph improvements
JPA’s EntityGraph feature is cumbersome to define and use. Hibernate ORM 5.4 adds 2 new features to help make working with EntityGraphs easier.
Note that all these improvements are considered incubating.
EntityGraph parsing
The first feature is the ability to create a graph from a String representation. E.g., given a Person entity, we might want to make sure the Person’s spouse is eagerly fetched:
final EntityGraph eg = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse", entityManager );
final Person personAndSpouse = entityManager.find( Person.class, 1,
Collections.singletonMap( "javax.persistence.fetchgraph", eg );
This parsing supports all of the features of EntityGraph creation including sub-graphs (though see second feature) and sub-class graphs. See the documentation for in-depth discussion and examples.
EntityGraph manipulation
This is mainly about combining graphs. E.g.
final EntityGraph eg1 = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse", entityManager );
final EntityGraph eg2 = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse(age, dob)", entityManager );
final EntityGraph combinedGraph = org.hibernate.graph.EntityGraphs.merge( entityManager, Person.class, eg1, eg2 )
final Person personAndSpouse = entityManager.find( Person.class, 1,
Collections.singletonMap( "javax.persistence.fetchgraph", combinedGraph );
This is a very trivial example meant just for illustration. It can actually be much more easily defined as:
final EntityGraph combinedGraph = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse( age, dob )", entityManager );
final Person personAndSpouse = entityManager.find( Person.class, 1,
Collections.singletonMap( "javax.persistence.fetchgraph", combinedGraph );
JDK 11 support
5.4.0 will support JDK 11 out of the box e.g. no need for additional dependencies or environment variable as required with 5.3.
Getting 5.4.0.CR1
All details are available and up to date on the dedicated page on hibernate.org.
What’s next?
We will release 5.4.0.Final in the coming weeks and will release regular maintenance releases thereafter.
Feedback, issues, ideas?
To get in touch, use the usual channels:
-
hibernate tag on Stack Overflow (usage questions)
-
User forum (usage questions, general feedback)
-
Issue tracker (bug reports, feature requests)
-
Mailing list (development-related discussions)