diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java index 422085d0a6..913755bd7d 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java @@ -1053,6 +1053,9 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces } protected boolean skipInitialization(Object toInitialize, RowProcessingState rowProcessingState) { + if ( !isOwningInitializer ) { + return true; + } final EntityEntry entry = rowProcessingState.getSession().getPersistenceContextInternal().getEntry( toInitialize ); if ( entry == null ) { @@ -1062,7 +1065,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces else if ( entry.getStatus().isDeletedOrGone() ) { return true; } - else if ( isOwningInitializer ) { + else { if ( isPersistentAttributeInterceptable( toInitialize ) ) { final PersistentAttributeInterceptor interceptor = asPersistentAttributeInterceptable( toInitialize ).$$_hibernate_getInterceptor(); @@ -1086,9 +1089,6 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces return false; } } - else { - return true; - } } private boolean isReadOnly(RowProcessingState rowProcessingState, SharedSessionContractImplementor persistenceContext) {