diff --git a/migration-guide.adoc b/migration-guide.adoc index 3c8060e565..3ab9d42cb0 100644 --- a/migration-guide.adoc +++ b/migration-guide.adoc @@ -41,3 +41,25 @@ This strategy may require `hibernate.default_schema` and/or `hibernate.default_c To use the old strategy, which executes a `java.sql.DatabaseMetaData#getTables(String, String, String, String[])` call for each javax.persistence.Entity, use the property setting `hibernate.hbm2ddl.jdbc_metadata_extraction_strategy=individually`. + + +=== Many-to-one association in embeddable collection elements and composite IDs + +A bug introduced in 4.3 caused many-to-one associations in embeddable collection elements and +composite IDs to be eagerly fetched, even when explicitly mapped as lazy. + +This bug does not affect many-to-one associations that are not in a composite ID or embeddable +collection element. + +In 5.1.15, this bug was fixed. As a result, such associations will be fetched as specified +by their mappings. + +Many-to-one associations mapped by using native HBM xml are lazy by default. In order to keep +the associations eager in 5.1.15 and later, mappings will need to explicitly specify that +they are non-lazy. + +When mapped with annotations, many-to-one associations use `FetchType.EAGER` by default. +Starting in 5.1.15, if an association is mapped with `FetchType.LAZY`, the assocation will +be lazily fetched, as expected. + +See details on the https://hibernate.atlassian.net/browse/HHH-12687[HHH-12687] Jira issue.