Move persistence context access in EntitySelectFetchInitializer to fix PostgreSQL issues

This commit is contained in:
Christian Beikov 2020-12-01 18:32:26 +01:00
parent 7f1a60c4c6
commit 604cef2cb6
1 changed files with 6 additions and 6 deletions

View File

@ -123,6 +123,12 @@ public class EntitySelectFetchInitializer extends AbstractFetchParentAccess impl
final EntityKey entityKey = new EntityKey( entityIdentifier, concreteDescriptor );
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
entityInstance = persistenceContext.getEntity( entityKey );
if ( entityInstance != null ) {
return;
}
Initializer initializer = rowProcessingState.getJdbcValuesSourceProcessingState().findInitializer(
entityKey );
@ -140,12 +146,6 @@ public class EntitySelectFetchInitializer extends AbstractFetchParentAccess impl
return;
}
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
entityInstance = persistenceContext.getEntity( entityKey );
if ( entityInstance != null ) {
return;
}
final LoadingEntityEntry existingLoadingEntry = session
.getPersistenceContext()
.getLoadContexts()