Skip to content

Commit a62aa8f

Browse files
committed
HHH-19260 - Move supportsRowValueConstructorSyntaxInInSubQuery() to Dialect
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 5599948 commit a62aa8f

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/OracleLegacyDialect.java

+5
Original file line numberDiff line numberDiff line change
@@ -1701,4 +1701,9 @@ public boolean supportsRowValueConstructorSyntaxInInList() {
17011701
return getVersion().isSameOrAfter( 8, 2 );
17021702
}
17031703

1704+
@Override
1705+
public boolean supportsRowValueConstructorSyntaxInInSubQuery() {
1706+
return getVersion().isSameOrAfter( 9 );
1707+
}
1708+
17041709
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/OracleLegacySqlAstTranslator.java

-5
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,6 @@ else if ( expression instanceof Summarization ) {
664664
}
665665
}
666666

667-
@Override
668-
protected boolean supportsRowValueConstructorSyntaxInInSubQuery() {
669-
return getDialect().getVersion().isSameOrAfter( 9 );
670-
}
671-
672667
private boolean supportsOffsetFetchClause() {
673668
return getDialect().supportsFetchClause( FetchClauseType.ROWS_ONLY );
674669
}

hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java

+13
Original file line numberDiff line numberDiff line change
@@ -6047,4 +6047,17 @@ public boolean supportsRowValueConstructorSyntaxInInList() {
60476047
return true;
60486048
}
60496049

6050+
/**
6051+
* If the dialect supports {@link org.hibernate.dialect.Dialect#supportsRowValueConstructorSyntax() row values},
6052+
* does it offer such support in IN subqueries as well?
6053+
* <p>
6054+
* For example, {@code ... where (FIRST_NAME, LAST_NAME) IN ( select ... ) ...}
6055+
*
6056+
* @return True if this SQL dialect is known to support "row value
6057+
* constructor" syntax in the IN subqueries; false otherwise.
6058+
*/
6059+
public boolean supportsRowValueConstructorSyntaxInInSubQuery() {
6060+
return supportsRowValueConstructorSyntaxInInList();
6061+
}
6062+
60506063
}

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

+2-15
Original file line numberDiff line numberDiff line change
@@ -7647,7 +7647,7 @@ else if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
76477647
ComparisonOperator.NOT_EQUAL :
76487648
ComparisonOperator.EQUAL;
76497649
// Some DBs like Oracle support tuples only for the IN subquery predicate
7650-
if ( supportsRowValueConstructorSyntaxInInSubQuery() && dialect.supportsUnionAll() ) {
7650+
if ( dialect.supportsRowValueConstructorSyntaxInInSubQuery() && dialect.supportsUnionAll() ) {
76517651
inListPredicate.getTestExpression().accept( this );
76527652
if ( inListPredicate.isNegated() ) {
76537653
appendSql( " not" );
@@ -7784,7 +7784,7 @@ public void visitInSubQueryPredicate(InSubQueryPredicate inSubQueryPredicate) {
77847784
appendSql( " in " );
77857785
inSubQueryPredicate.getSubQuery().accept( this );
77867786
}
7787-
else if ( !supportsRowValueConstructorSyntaxInInSubQuery() ) {
7787+
else if ( !dialect.supportsRowValueConstructorSyntaxInInSubQuery() ) {
77887788
emulateSubQueryRelationalRestrictionPredicate(
77897789
inSubQueryPredicate,
77907790
inSubQueryPredicate.isNegated(),
@@ -8399,19 +8399,6 @@ private boolean needsTupleComparisonEmulation(ComparisonOperator operator) {
83998399
};
84008400
}
84018401

8402-
/**
8403-
* If the dialect supports {@link org.hibernate.dialect.Dialect#supportsRowValueConstructorSyntax() row values},
8404-
* does it offer such support in IN subqueries as well?
8405-
* <p>
8406-
* For example, {@code ... where (FIRST_NAME, LAST_NAME) IN ( select ... ) ...}
8407-
*
8408-
* @return True if this SQL dialect is known to support "row value
8409-
* constructor" syntax in the IN subqueries; false otherwise.
8410-
*/
8411-
protected boolean supportsRowValueConstructorSyntaxInInSubQuery() {
8412-
return dialect.supportsRowValueConstructorSyntaxInInList();
8413-
}
8414-
84158402
/**
84168403
* Returns a table expression that has one row.
84178404
*

0 commit comments

Comments
 (0)