Describes the new features and capabilities added to Hibernate ORM in 7.1.

If migrating from earlier versions, be sure to also check out the Migration Guide for discussion of impactful changes.

Resource Discovery in SE Environments

The Jakarta Persistence specification defines the ability for a provider to discover "managed resources" in EE environments, alleviating the application from manually listing all classes and XML files. However, it defines no such support in SE environments.

Starting with 7.1, Hibernate now supports this discovery in SE environments, by allowing applications to specify the root URL and zero-or-more "jar" URLs to search. These URLs correspond to

  • jakarta.persistence.spi.PersistenceUnitInfo#getPersistenceUnitRootUrl

  • jakarta.persistence.spi.PersistenceUnitInfo#getJarFileUrls

These URLs are searched for managed resources according to the process defined in the specification.

Locking

org.hibernate.Locking has been introduced to support various aspects of pessimistic locking:

  • Locking.Scope is an extension of jakarta.persistence.PessimisticLockScope including some Hibernate-specific options.

  • Locking.FollowOn allows controlling Hibernate’s follow-on locking behavior.

Additionally, we’ve added org.hibernate.Timeouts to help deal with some standard jakarta.persistence.Timeout values.

Interceptor and merge

Support for intercepting Session#merge events has been added to Hibernate’s Interceptor.