Describes the new features and capabilities added to Hibernate ORM in 8.1.
|
Important
|
If migrating from earlier versions, be sure to also check out the Migration Guide for discussion of impactful changes. |
@SQLRestriction and @Filter may now be declared directly on @ManyToOne and @OneToOne
associations, including associations mapped using join tables.
Restrictions apply to the target through that association, consistently across eager and lazy fetching.
An excluded target is represented as null while its stored reference is preserved during unrelated updates.
Association filters apply whenever enabled, independently of @FilterDef.applyToLoadByKey.
See the user guide for examples and
the migration guide for the update and merge semantics.
Schema management DDL now uses CREATE SCHEMA IF NOT EXISTS and DROP SCHEMA IF EXISTS for dialects which support these clauses, avoiding warnings when a schema already exists or has already been dropped.
Supported dialects: PostgreSQL, CockroachDB, H2, HSQLDB, SAP HANA, and SQL Server (DROP only, version 13+).
A @OneToOne association whose join mixes physical @JoinColumn`s with `@JoinFormula`s (via
`@JoinColumnOrFormula/@JoinColumnsOrFormulas, or the equivalent <one-to-one> mapping XML) is
now recognized and bound as a true one-to-one association instead of falling back to a logical
many-to-one. For each physical join column that is also part of the owner’s primary key, Hibernate
infers insertable=false, updatable=false, since the identifier mapping already owns that column’s
value. See the user guide for details and examples.