Skip to content

Commit 3c5e512

Browse files
author
Mike Mannion
committed
HHH-19497 Distribute 'not' to create a slightly terser implementation and predicate.
1 parent da84610 commit 3c5e512

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7643,9 +7643,6 @@ public void visitInListPredicate(InListPredicate inListPredicate) {
76437643
.getExpressions().get( 0 );
76447644
}
76457645
else if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
7646-
final ComparisonOperator comparisonOperator = inListPredicate.isNegated() ?
7647-
ComparisonOperator.NOT_EQUAL :
7648-
ComparisonOperator.EQUAL;
76497646
// Some DBs like Oracle support tuples only for the IN subquery predicate
76507647
if ( dialect.supportsRowValueConstructorSyntaxInInSubQuery() && dialect.supportsUnionAll() ) {
76517648
inListPredicate.getTestExpression().accept( this );
@@ -7664,20 +7661,17 @@ else if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
76647661
appendSql( CLOSE_PARENTHESIS );
76657662
}
76667663
else {
7667-
if (inListPredicate.isNegated()) {
7668-
appendSql("not ");
7669-
}
76707664
appendSql( OPEN_PARENTHESIS );
76717665
String separator = NO_SEPARATOR;
76727666
for (Expression expression : listExpressions) {
76737667
appendSql(separator);
76747668
emulateTupleComparison(
76757669
lhsTuple.getExpressions(),
76767670
SqlTupleContainer.getSqlTuple(expression).getExpressions(),
7677-
ComparisonOperator.EQUAL,
7671+
ComparisonOperator.NOT_EQUAL,
76787672
true
76797673
);
7680-
separator = " or ";
7674+
separator = " and ";
76817675
}
76827676
appendSql( CLOSE_PARENTHESIS );
76837677
}

0 commit comments

Comments
 (0)