From 15b52460f3ade96860815e06286f5835340b97bd Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 10 Mar 2021 14:36:38 +0100 Subject: [PATCH] BaseSqmToSqlAstConverter#consumeEntityJoin() postpone tableGroupJoin.applyPredicate after consuming implicit joins --- .../hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 3fcdadd1f7..431a6e6b2a 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 @@ -1841,6 +1841,9 @@ public abstract class BaseSqmToSqlAstConverter extends Base ); lhsTableGroup.addTableGroupJoin( tableGroupJoin ); + consumeExplicitJoins( sqmJoin, tableGroupJoin.getJoinedGroup() ); + consumeImplicitJoins( sqmJoin, tableGroupJoin.getJoinedGroup() ); + // add any additional join restrictions if ( sqmJoin.getJoinPredicate() != null ) { tableGroupJoin.applyPredicate( @@ -1848,8 +1851,6 @@ public abstract class BaseSqmToSqlAstConverter extends Base ); } - consumeExplicitJoins( sqmJoin, tableGroupJoin.getJoinedGroup() ); - consumeImplicitJoins( sqmJoin, tableGroupJoin.getJoinedGroup() ); } private void consumeImplicitJoins(SqmPath sqmPath, TableGroup tableGroup) {