From c6e30f8042c0995a555518c118ccb1b2bfc248eb Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Sun, 12 Feb 2023 10:13:18 +0100 Subject: [PATCH] HHH-15990 unable to determine TableReference when associate ManyToOne fetch lazy and NotFound IGNORE --- .../org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index a1e5531767..0ff335a54a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -3769,7 +3769,7 @@ public abstract class BaseSqmToSqlAstConverter extends Base if ( inferredEntityMapping == null ) { // When the inferred mapping is null, we try to resolve to the FK by default, // which is fine because expansion to all target columns for select and group by clauses is handled below - if ( entityValuedModelPart instanceof EntityAssociationMapping && ( (EntityAssociationMapping) entityValuedModelPart ).getSideNature() != ForeignKeyDescriptor.Nature.TARGET ) { + if ( entityValuedModelPart instanceof EntityAssociationMapping && ( (EntityAssociationMapping) entityValuedModelPart ).isFkOptimizationAllowed() ) { // If the table group uses an association mapping that is not a one-to-many, // we make use of the FK model part final EntityAssociationMapping associationMapping = (EntityAssociationMapping) entityValuedModelPart;