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 55a5be5c9d
commit 36fc27dd4a
1 changed files with 4 additions and 4 deletions

View File

@ -1048,6 +1048,9 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
} }
protected boolean skipInitialization(Object toInitialize, RowProcessingState rowProcessingState) { protected boolean skipInitialization(Object toInitialize, RowProcessingState rowProcessingState) {
if ( !isOwningInitializer ) {
return true;
}
final EntityEntry entry = final EntityEntry entry =
rowProcessingState.getSession().getPersistenceContextInternal().getEntry( toInitialize ); rowProcessingState.getSession().getPersistenceContextInternal().getEntry( toInitialize );
if ( entry == null ) { if ( entry == null ) {
@ -1057,7 +1060,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
else if ( entry.getStatus().isDeletedOrGone() ) { else if ( entry.getStatus().isDeletedOrGone() ) {
return true; return true;
} }
else if ( isOwningInitializer ) { else {
if ( isPersistentAttributeInterceptable( toInitialize ) ) { if ( isPersistentAttributeInterceptable( toInitialize ) ) {
final PersistentAttributeInterceptor interceptor = final PersistentAttributeInterceptor interceptor =
asPersistentAttributeInterceptable( toInitialize ).$$_hibernate_getInterceptor(); asPersistentAttributeInterceptable( toInitialize ).$$_hibernate_getInterceptor();
@ -1081,9 +1084,6 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
return false; return false;
} }
} }
else {
return true;
}
} }
private boolean isReadOnly(RowProcessingState rowProcessingState, SharedSessionContractImplementor persistenceContext) { private boolean isReadOnly(RowProcessingState rowProcessingState, SharedSessionContractImplementor persistenceContext) {