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 1737ee457d
commit d3674186bf
1 changed files with 5 additions and 1 deletions

View File

@ -519,6 +519,10 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
if ( Hibernate.isInitialized( entityInstance ) ) { if ( Hibernate.isInitialized( entityInstance ) ) {
this.isInitialized = true; this.isInitialized = true;
registerReloadedEntity( rowProcessingState, holder ); registerReloadedEntity( rowProcessingState, holder );
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) {
// We need to read result set values to correctly populate the query cache
resolveState( rowProcessingState );
}
} }
} }
} }
@ -532,7 +536,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
registerReloadedEntity( rowProcessingState, holder ); registerReloadedEntity( rowProcessingState, holder );
notifyResolutionListeners( entityInstance ); notifyResolutionListeners( entityInstance );
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) { 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 ); resolveState( rowProcessingState );
} }
} }