As you can expect from a new major version, Hibernate 6 brought many changes. The most noticeable ones were the update to JPA 3 and the removal of Hibernate’s proprietary and long-deprecated Criteria API. But these are, of course, not the only ones. The release already brought us better performance, new features, and several improvements to existing mapping and query features.

You can find my articles explaining all the new and improved features below. But before you focus on the new things, let me quickly tell you how to migrate your application to Hibernate 6.

In contrast to previous releases, version 6 includes a few breaking changes. Most of them were caused by JPA 3, which had to rename all packages and configuration parameters. And the Hibernate team created some themselves by removing a few deprecated APIs. But don’t worry. It’s not as bad as it might sound. You can migrate most projects in a few hours. I summarized the necessary steps in the article on the right and documented the migration of an example project in the Persistence Hub.

New Mapping Features

Hibernate 6 introduced several new mapping features and improved existing ones. To name just a few, you can now map composite column types and use Java Records to model Embeddable. And you can benefit from the improved mapping of ZonedDateTime, a more flexible instantiation of Embeddables, and a drastically simplified mapping of JSON columns.

  • How to configure List semantics in Hibernate 6

    How to configure List semantics in Hibernate 6

    Based on its javadoc, a java.util.List is supposed to represent an ordered collection of values. But that’s not necessarily the case if you use it as the type of a to-many association or an ElementCollection. As I explained before, Hibernate can handle a java.util.List as a Bag or a List. Only the List mapping persists the order…

  • Hibernate 6 EmbeddableInstantiator – Instantiate embeddables your way

    Hibernate 6 EmbeddableInstantiator – Instantiate embeddables your way

    Embeddables are simple Java objects. They provide an easy way to define and group a set of attributes that become part of your entity. Developers often use them to create reusable mapping information and handle them using the same piece of business code. Unfortunately, the JPA specification and Hibernate until version 6.0.0, required your embeddable…

New Query Features

In addition to the new mapping capabilities, the Hibernate team also drastically improved Hibernate’s query capabilities. E.g., you can now use window functions in your JPQL queries, a streamlined version of Hibernate’s popular ResultTransformer, and Hibernate’s proprietary extensions to the Criteria API.