Use FetchMode.Join to load OneToOne associations that have the same AssociationKey as the entity owner

Description

The fix for (correctly) changed the AssociationKey for a one-to-one association to be the same as the AssociationKey of the parent entity while building load plans. Hibernate incorrectly assumes that the one-to-one association is a duplicate association. As a result, Hibernate uses FetchMode.SELECT to load the one-to-one association.

This issue will deal with this special case where the parent entity is the EntityReturn. It will change the association back to use FetchMode.JOIN.

Activity

Show:

Former user July 14, 2021 at 4:28 PM

This may end up being fixed by .

Former user February 15, 2021 at 10:20 PM

This issue specifically affects the following use cases:

Tests should be created for both unidirectional and bidirectional associations that are EAGER.

Former user February 11, 2021 at 12:03 AM

This issue depends on so that it is possible to use FetchMode#SELECT to override this fix.

Former user February 20, 2020 at 6:44 AM
Edited

The PR for this issue only works when using Session/EntityManager#find. The same issue affects queries.

Former user November 7, 2018 at 5:24 AM

This may fix HHH-10842.

Details

Assignee

Reporter

Components

Fix versions

Priority

Created November 7, 2018 at 5:20 AM
Updated July 14, 2021 at 4:28 PM