Skip to content

Commit fc5b184

Browse files
mbelladebeikov
authored andcommitted
HHH-17329 Resolve state for query cache for initialized proxies
1 parent 2570cbe commit fc5b184

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,14 @@ protected void resolveEntityInstance(
506506
}
507507
else {
508508
entityInstance = proxy;
509+
if ( Hibernate.isInitialized( entityInstance ) ) {
510+
this.isInitialized = true;
511+
registerReloadedEntity( rowProcessingState, entityInstance );
512+
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) {
513+
// We need to read result set values to correctly populate the query cache
514+
resolveState( rowProcessingState );
515+
}
516+
}
509517
}
510518
}
511519
else {
@@ -518,7 +526,7 @@ protected void resolveEntityInstance(
518526
registerReloadedEntity( rowProcessingState, existingEntity );
519527
notifyResolutionListeners( entityInstance );
520528
if ( rowProcessingState.getQueryOptions().isResultCachingEnabled() == Boolean.TRUE ) {
521-
// We still need to read result set values to correctly populate the query cache
529+
// We need to read result set values to correctly populate the query cache
522530
resolveState( rowProcessingState );
523531
}
524532
}

0 commit comments

Comments
 (0)