From 8f85f0a6d932c00204e2560ddce6b0e5bb5bba9b Mon Sep 17 00:00:00 2001 From: Marco Belladelli Date: Mon, 10 Jul 2023 16:04:49 +0200 Subject: [PATCH] HHH-16871 Simplified maximum fetch depth condition --- .../org/hibernate/loader/ast/internal/LoaderSelectBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSelectBuilder.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSelectBuilder.java index a1a3c3bafb..7c8b4b5c67 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSelectBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSelectBuilder.java @@ -972,8 +972,9 @@ public class LoaderSelectBuilder { joined = false; } else if ( fetchDepth > maximumFetchDepth + 1 ) { + // We can preserve the existing value of joined for basic and embedded values if ( !( fetchable instanceof BasicValuedModelPart ) && !( fetchable instanceof EmbeddedAttributeMapping ) ) { - return; + joined = false; } } }