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 a73bc08c78
commit 6c690f561c
1 changed files with 4 additions and 1 deletions

View File

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