Skip to content

Commit

Permalink
HHH-16495 SemanticException for non-cross entity joins without predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed May 26, 2023
1 parent 35b8bd1 commit 9e09c05
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3403,13 +3403,18 @@ private TableGroup consumeEntityJoin(SqmEntityJoin<?> sqmJoin, TableGroup lhsTab
predicate.get()
);

// add any additional join restrictions
if ( sqmJoin.getJoinPredicate() != null ) {
final SqmJoin<?, ?> oldJoin = currentlyProcessingJoin;
currentlyProcessingJoin = sqmJoin;
tableGroupJoin.applyPredicate( visitNestedTopLevelPredicate( sqmJoin.getJoinPredicate() ) );
currentlyProcessingJoin = oldJoin;
}
else if ( correspondingSqlJoinType != SqlAstJoinType.CROSS ) {
throw new SemanticException(
"Entity join did not specify a predicate, " +
"please define an on clause or use an explicit cross join: " + sqmJoin
);
}

// Note that we add the entity join after processing the predicate because implicit joins needed in there
// can be just ordered right before the entity join without changing the semantics
Expand Down

0 comments on commit 9e09c05

Please sign in to comment.