HHH-17329 Resolve state for query cache for initialized proxies

This commit is contained in:
Marco Belladelli 2023-10-18 10:07:38 +02:00 committed by Christian Beikov
parent 6c28f9edc1
commit d2f0e05126
1 changed files with 9 additions and 1 deletions

View File

@ -506,6 +506,14 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
}
else {
entityInstance = proxy;
if ( Hibernate.isInitialized( entityInstance ) ) {
this.isInitialized = true;
registerReloadedEntity( rowProcessingState, Hibernate.unproxy( proxy ) );
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) {
// We need to read result set values to correctly populate the query cache
resolveState( rowProcessingState );
}
}
}
}
else {
@ -518,7 +526,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
registerReloadedEntity( rowProcessingState, existingEntity );
notifyResolutionListeners( entityInstance );
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) {
// We still need to read result set values to correctly populate the query cache
// We need to read result set values to correctly populate the query cache
resolveState( rowProcessingState );
}
}