diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java index d817bf3365..6de549f536 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java @@ -1950,8 +1950,7 @@ public abstract class AbstractSqlAstTranslator implemen } break; } - case EQUAL: - case NOT_EQUAL: { + case EQUAL: { final String operatorText = operator.sqlText(); String separator = NO_SEPARATOR; for ( int i = 0; i < size; i++ ) { @@ -1963,6 +1962,18 @@ public abstract class AbstractSqlAstTranslator implemen } break; } + case NOT_EQUAL: { + final String operatorText = operator.sqlText(); + String separator = NO_SEPARATOR; + for ( int i = 0; i < size; i++ ) { + appendSql( separator ); + lhsExpressions.get( i ).accept( this ); + appendSql( operatorText ); + rhsExpressions.get( i ).accept( this ); + separator = " or "; + } + break; + } case LESS_THAN_OR_EQUAL: // Optimized (a, b) <= (1, 2) as: a <= 1 and not (a = 1 and b > 2) // Normal (a, b) <= (1, 2) as: a < 1 or a = 1 and (b <= 2)