HHH-16897 Push a where clause to stack before combining predicates

This commit is contained in:
marko-bekhta 2023-07-05 17:34:43 +02:00 committed by Steve Ebersole
parent 21f2f24bb7
commit 6e727b6fe4
1 changed files with 3 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import org.hibernate.query.sqm.tree.from.SqmRoot;
import org.hibernate.query.sqm.tree.insert.SqmInsertStatement; import org.hibernate.query.sqm.tree.insert.SqmInsertStatement;
import org.hibernate.query.sqm.tree.predicate.SqmWhereClause; import org.hibernate.query.sqm.tree.predicate.SqmWhereClause;
import org.hibernate.query.sqm.tree.update.SqmSetClause; import org.hibernate.query.sqm.tree.update.SqmSetClause;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.SqlAstCreationContext; import org.hibernate.sql.ast.spi.SqlAstCreationContext;
import org.hibernate.sql.ast.spi.SqlAstHelper; import org.hibernate.sql.ast.spi.SqlAstHelper;
import org.hibernate.sql.ast.spi.SqlAstProcessingState; import org.hibernate.sql.ast.spi.SqlAstProcessingState;
@ -214,12 +215,14 @@ public class MultiTableSqmMutationConverter extends BaseSqmToSqlAstConverter<Sta
pushProcessingState( restrictionProcessingState, getFromClauseIndex() ); pushProcessingState( restrictionProcessingState, getFromClauseIndex() );
try { try {
getCurrentClauseStack().push( Clause.WHERE );
return SqlAstHelper.combinePredicates( return SqlAstHelper.combinePredicates(
(Predicate) sqmWhereClause.getPredicate().accept( this ), (Predicate) sqmWhereClause.getPredicate().accept( this ),
discriminatorPredicate discriminatorPredicate
); );
} }
finally { finally {
getCurrentClauseStack().pop();
popProcessingStateStack(); popProcessingStateStack();
this.parameterResolutionConsumer = null; this.parameterResolutionConsumer = null;
} }