HHH-14251 Invalid SQL for @Embedded UPDATE

This commit is contained in:
Andrea Boriero 2020-10-12 13:28:47 +01:00 committed by Sanne Grinovero
parent cb04aa1e5d
commit ec7a278358

View File

@ -9,6 +9,7 @@
import org.hibernate.QueryException;
import org.hibernate.engine.internal.JoinSequence;
import org.hibernate.hql.internal.CollectionProperties;
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
import org.hibernate.hql.internal.antlr.SqlTokenTypes;
import org.hibernate.hql.internal.ast.util.ASTUtil;
import org.hibernate.hql.internal.ast.util.ColumnHelper;
@ -256,7 +257,7 @@ private void initText() {
boolean countDistinct = getWalker().isInCountDistinct()
&& getWalker().getSessionFactoryHelper().getFactory().getDialect().requiresParensForTupleDistinctCounts();
if ( cols.length > 1 &&
( getWalker().isComparativeExpressionClause() || countDistinct ) ) {
( getWalker().isComparativeExpressionClause() || countDistinct || getWalker().getCurrentClauseType() == HqlSqlTokenTypes.SET ) ) {
text = "(" + text + ")";
}
setText( text );