Fix broken Session#refresh() method

This commit is contained in:
Andrea Boriero 2022-01-03 14:32:53 +01:00 committed by Andrea Boriero
parent e27f6af4b9
commit 9c7d39abf1
1 changed files with 12 additions and 12 deletions

View File

@ -390,6 +390,18 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
return;
}
final SharedSessionContractImplementor session = rowProcessingState
.getJdbcValuesSourceProcessingState()
.getSession();
final PersistenceContext persistenceContext = session.getPersistenceContext();
// Special case map proxy to avoid stack overflows
// We know that a map proxy will always be of "the right type" so just use that object
final LoadingEntityEntry existingLoadingEntry = persistenceContext
.getLoadContexts()
.findLoadingEntityEntry( entityKey );
setIsOwningInitializer( entityKey.getIdentifier(), existingLoadingEntry );
if ( entityInstance != null ) {
return;
}
@ -405,19 +417,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
);
}
final SharedSessionContractImplementor session = rowProcessingState
.getJdbcValuesSourceProcessingState()
.getSession();
final PersistenceContext persistenceContext = session.getPersistenceContext();
final Object proxy = getProxy( persistenceContext );
// Special case map proxy to avoid stack overflows
// We know that a map proxy will always be of "the right type" so just use that object
final LoadingEntityEntry existingLoadingEntry = persistenceContext
.getLoadContexts()
.findLoadingEntityEntry( entityKey );
setIsOwningInitializer(entityKey.getIdentifier(), existingLoadingEntry );
final Object entityInstanceFromExecutionContext = rowProcessingState.getJdbcValuesSourceProcessingState()
.getExecutionContext()
.getEntityInstance();