From d21b5c21becd419a82e718212b7d559d36caeeb8 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Tue, 7 Mar 2023 12:02:39 +0100 Subject: [PATCH] HHH-16258 NPE with SubselectFetch and inheritance --- .../loader/ast/internal/CollectionLoaderSubSelectFetch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CollectionLoaderSubSelectFetch.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CollectionLoaderSubSelectFetch.java index 1a800cb336..25d9e6b501 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CollectionLoaderSubSelectFetch.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CollectionLoaderSubSelectFetch.java @@ -106,7 +106,7 @@ public class CollectionLoaderSubSelectFetch implements CollectionLoader { new CollectionKey( attributeMapping.getCollectionDescriptor(), key.getIdentifier() ) ); - if ( containedCollection != collection ) { + if ( containedCollection != null && containedCollection != collection ) { containedCollection.beginRead(); containedCollection.beforeInitialize( getLoadable().getCollectionDescriptor(), -1 );