HHH-16960 OneToOne lazy loading fails when fetch graph is involved

This commit is contained in:
Andrea Boriero 2024-01-22 19:35:20 +01:00 committed by Christian Beikov
parent b813d9b652
commit 7e0cdf5d06
1 changed files with 4 additions and 1 deletions

View File

@ -1630,9 +1630,12 @@ public class ToOneAttributeMapping
final boolean selectByUniqueKey = isSelectByUniqueKey( side ); final boolean selectByUniqueKey = isSelectByUniqueKey( side );
// Consider all associations annotated with @NotFound as EAGER // Consider all associations annotated with @NotFound as EAGER
// and LAZY one-to-one that are not instrumented and not optional
if ( fetchTiming == FetchTiming.IMMEDIATE if ( fetchTiming == FetchTiming.IMMEDIATE
|| hasNotFoundAction() || hasNotFoundAction()
|| getAssociatedEntityMappingType().getSoftDeleteMapping() != null ) { || getAssociatedEntityMappingType().getSoftDeleteMapping() != null
|| ( !entityMappingType.getEntityPersister().isInstrumented()
&& cardinality == Cardinality.ONE_TO_ONE && isOptional ) ) {
return buildEntityFetchSelect( return buildEntityFetchSelect(
fetchParent, fetchParent,
this, this,