From 094a9a1652dd9fac97d38c958a903fe81bbd50a8 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Mon, 16 Sep 2024 17:52:13 +0200 Subject: [PATCH] HHH-18608 NPE in EntityInitializerImpl.resolveInstanceSubInitializers --- .../results/graph/entity/internal/EntityInitializerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java index d9610b4f03b4..a62e65fd1097 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java @@ -625,6 +625,10 @@ protected void resolveInstanceSubInitializers(EntityInitializerData data) { final EntityEntry entityEntry = data.entityHolder.getEntityEntry(); final Initializer[] initializers; final ImmutableBitSet maybeLazySet; + if ( entityEntry == null ) { + assert data.entityHolder.getEntityInitializer() != null && data.entityHolder.getProxy() != null; + return; + } if ( data.entityHolder.getEntityInitializer() == this ) { // When a previous row initialized this entity already, we only need to process collections initializers = collectionContainingSubInitializers[subclassId];