Hibernate ORM 8.0.0.Beta2 is now available
The second beta of Hibernate ORM 8.0 brings stronger concurrency guarantees, expanded Jakarta Persistence 4 support, and substantial improvements to migration from legacy XML mappings. It also introduces more convenient configuration options and clarifies the contracts available to integration and dialect providers.
Highlights include:
-
Locking and concurrency improvements. Optimistic version checks now account for database behavior that could previously allow concurrent changes to go undetected. Version locking is supported for
StatelessSessionand Jakarta Persistence’sEntityAgent, and concurrent stateless upserts handle insert races correctly. Tenant identifiers are now consistently included in generated mutation SQL, strengthening isolation for discriminator-based multitenancy. -
Expanded Jakarta Persistence 4 support. Entity listeners can now be declared at package or module scope, and module descriptors can declare named queries and other mapping metadata. The new
@PostCreateand@PreClosecallbacks allow listeners to observe the lifecycle of entity manager factories, entity managers, and entity agents. -
Improved XML mapping migration.
HbmXmlTransformermore faithfully preserves legacyhbm.xmlmappings when converting them to Hibernate’s extendedorm.xmlformat. Improvements cover composite identifiers, inheritance, associations, collections, custom types, constraints, and stored procedures. -
More convenient configuration and diagnostics. Typed session and query options cover filtering, JDBC batch and fetch sizes, query-result caching, and SQL comments. The new
AdjustableSettingsAPI allows selected diagnostic settings, including SQL logging and slow-query thresholds, to change at runtime.@DefaultListSemanticsprovides package- and module-level control over whether eligible list attributes use bag or indexed-list semantics. -
Client enhancement and redesigned enhancement SPI. Optional client enhancement rewrites direct entity-field access from application classes so that it participates in lazy loading and dirty tracking. The enhancement SPI now separates the mapping model, enhancement options, and execution environment, replacing
EnhancementContextwithEnhancementModel,EnhancementOptions, andEnhancementEnvironment. Client enhancement is exposed separately from managed-class enhancement, including a dedicated transformer for container integration. Integrators using the enhancement SPI should review the migration guidance. -
Clearer extension contracts. The new
@SPIannotation distinguishes contracts integration providers may use, implement, or supply. Dialect extension contracts now have explicit classifications, and the central SQL AST and translator SPIs are out of incubation. For non-incubating SPIs, compatibility expectations apply across maintenance releases of the sameX.Yrelease family. -
Query and persistence correctness fixes.
@SQLRestrictionsupports additional mappings, including references to non-primary-table columns and many-to-one associations mapped through join tables. H2, Oracle, and SQL Server now correctly handleon conflict (…) do nothingwith explicit conflict columns. A fix to enhanced dirty tracking also prevents changed scalar values from being omitted from dynamic updates when nested embeddables are dirty.
When upgrading, note that Hibernate now passes java.time values directly to JDBC by default where supported, with fallback for known driver limitations. OSGi manifest metadata and relocation POMs under the old org.hibernate group ID are no longer published, and support for custom cascade implementations and legacy lock cascading has been removed. Custom property-access implementations and dialect integrations should also review the updated Migration Guide.
Be sure to see -
Note that 8.0 remains in beta while Jakarta Persistence is not yet approved.
Please try Beta2 with your applications and let us know about any regressions or migration difficulties through Hibernate Jira.