HHH-16919 Always skip initialization for non-owning entity initializers

This commit is contained in:
Marco Belladelli 2023-08-04 10:24:40 +02:00
parent c228b5f477
commit 312431a231
1 changed files with 4 additions and 4 deletions

View File

@ -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) {