HHH-14874 Lazy loading of basic attributes in different @LazyGroups throws ArrayIndexOutOfBoundsException

This commit is contained in:
Andrea Boriero 2021-10-12 18:13:23 +02:00 committed by Andrea Boriero
parent 3b47b85ce8
commit 4323f9f011
1 changed files with 3 additions and 2 deletions

View File

@ -1651,6 +1651,7 @@ public abstract class AbstractEntityPersister
try { try {
Object result = null; Object result = null;
final Object[] values = lazySelect.load( id, session ); final Object[] values = lazySelect.load( id, session );
int i = 0;
for ( LazyAttributeDescriptor fetchGroupAttributeDescriptor : fetchGroupAttributeDescriptors ) { for ( LazyAttributeDescriptor fetchGroupAttributeDescriptor : fetchGroupAttributeDescriptors ) {
final boolean previousInitialized = initializedLazyAttributeNames.contains( fetchGroupAttributeDescriptor.getName() ); final boolean previousInitialized = initializedLazyAttributeNames.contains( fetchGroupAttributeDescriptor.getName() );
@ -1666,11 +1667,11 @@ public abstract class AbstractEntityPersister
// of course that would mean a new method on SelfDirtinessTracker to allow un-marking // of course that would mean a new method on SelfDirtinessTracker to allow un-marking
// its already been initialized (e.g. by a write) so we don't want to overwrite // its already been initialized (e.g. by a write) so we don't want to overwrite
i++;
continue; continue;
} }
final Object selectedValue = values[i++];
final Object selectedValue = values[fetchGroupAttributeDescriptor.getLazyIndex()];
final boolean set = initializeLazyProperty( final boolean set = initializeLazyProperty(
fieldName, fieldName,