HHH-16350 Pass correct state to pre-load events

This commit is contained in:
Marco Belladelli 2023-03-27 13:29:10 +02:00 committed by Christian Beikov
parent ab91f08ad8
commit bddfa7c5c6
1 changed files with 3 additions and 2 deletions

View File

@ -705,8 +705,6 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
@Override
public void initializeInstance(RowProcessingState rowProcessingState) {
if ( !missing && !isInitialized ) {
preLoad( rowProcessingState );
final LazyInitializer lazyInitializer = extractLazyInitializer( entityInstance );
final SharedSessionContractImplementor session = rowProcessingState.getSession();
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
@ -798,6 +796,8 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
resolvedEntityState = extractConcreteTypeStateValues( rowProcessingState );
preLoad( rowProcessingState );
if ( isPersistentAttributeInterceptable(toInitialize) ) {
PersistentAttributeInterceptor persistentAttributeInterceptor =
asPersistentAttributeInterceptable( toInitialize ).$$_hibernate_getInterceptor();
@ -1076,6 +1076,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
preLoadEvent.reset();
preLoadEvent.setEntity( entityInstance )
.setState( resolvedEntityState )
.setId( entityKey.getIdentifier() )
.setPersister( concreteDescriptor );