Skip to content

Commit 27b0110

Browse files
committed
HHH-19856 Make a copy of initializedLazyAttributeNames
to prevent it mutation within the init method
1 parent 61707e3 commit 27b0110

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,9 @@ private Object initLazyProperties(
16051605

16061606
final var interceptor = asPersistentAttributeInterceptable( entity ).$$_hibernate_getInterceptor();
16071607
assert interceptor != null : "Expecting bytecode interceptor to be non-null";
1608-
final Set<String> initializedLazyAttributeNames = interceptor.getInitializedLazyAttributeNames();
1608+
// Create a copy of init attrs, since lazySelectLoadPlan.load may update the set inside the interceptor,
1609+
// and we end up with the modified one here:
1610+
final Set<String> initializedLazyAttributeNames = new HashSet<>( interceptor.getInitializedLazyAttributeNames() );
16091611

16101612
final var lazyAttributesMetadata = getBytecodeEnhancementMetadata().getLazyAttributesMetadata();
16111613
final String fetchGroup = lazyAttributesMetadata.getFetchGroupName( fieldName );

0 commit comments

Comments
 (0)