HHH-16495 SemanticException for non-cross entity joins without predicate

This commit is contained in:
Marco Belladelli 2023-05-08 11:12:32 +02:00
parent 3d15041d84
commit 79f22d0287
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35
1 changed files with 6 additions and 1 deletions

View File

@ -3402,13 +3402,18 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
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