This guide discusses migration to Hibernate ORM version 7.4. For migration from earlier versions, see any other pertinent migration guides as well.
See the website for the list of requirements for the 7.4 series.
See the website for the list of new features in the 7.4 series.
This section describes changes to contracts (classes, interfaces, methods, etc.) which are considered API.
This section describes changes to contracts (classes, interfaces, methods, etc.) which are considered SPI.
This section describes changes in behavior that applications should be aware of.
Previously, MySQLDialect defined a dialect-level default value of 2 for the
hibernate.max_fetch_depth configuration property.
As of Hibernate ORM 7.4, this dialect-specific default has been removed. MySQL now behaves consistently with other dialects and relies on Hibernate’s general defaults or explicit user configuration.
Applications that relied on the previous implicit default should explicitly set
hibernate.max_fetch_depth if required.
An @Any discriminated association mapping defaults to fetch=EAGER.
Previously, such eager @Any associations were always fetched using a separate
SELECT statement, which was inefficient. Eager @Any associations are now
join fetched by default when an entity is loaded by id.
Previously, if a persistence unit had no @Entity classes, all schema management
actions (including import.sql execution) were silently skipped, even when explicitly
configured via hbm2ddl.auto or jakarta.persistence.schema-generation.database.action.
As of Hibernate 7.4, schema actions are now processed regardless of whether any entities
are mapped. This is the correct behavior, but it means that applications which have an
import.sql file on the classpath by accident may now see it executed when it was
previously ignored.
This section describes changes to DDL generated by the schema export tooling. Such changes typically do not impact programs using a relational schema managed externally to Hibernate.
A unique constraint is now added to the table mapped by an @ElementCollection set where appropriate.