Avoid NPE when resolving collection key for delayed collections

This commit is contained in:
Chris Cranford 2021-03-09 18:38:20 -05:00 committed by Christian Beikov
parent 71f633a8f7
commit 44719e9bb2
1 changed files with 6 additions and 2 deletions

View File

@ -76,8 +76,10 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
// LoggingHelper.toLoggableString( getNavigablePath(), this.collectionKey.getKey() ) // LoggingHelper.toLoggableString( getNavigablePath(), this.collectionKey.getKey() )
// ); // );
// } // }
if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) ); parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
} }
}
else { else {
final Object parentKey = parentAccess.getParentKey(); final Object parentKey = parentAccess.getParentKey();
if ( parentKey != null ) { if ( parentKey != null ) {
@ -85,10 +87,12 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
collectionAttributeMapping.getCollectionDescriptor(), collectionAttributeMapping.getCollectionDescriptor(),
parentKey parentKey
); );
if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) ); parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
} }
} }
} }
}
@Override @Override
public void resolveInstance(RowProcessingState rowProcessingState) { public void resolveInstance(RowProcessingState rowProcessingState) {