mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-08 20:24:46 +00:00
HHH-14242 Fix issue for Dialects supporting row value constructor Syntax but not in the SET clause
This commit is contained in:
parent
54ea3c15bf
commit
70f3a9260b
@ -2450,6 +2450,19 @@ public boolean supportsRowValueConstructorSyntax() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax,
|
||||
* sometimes called tuple syntax, in the SET clause;
|
||||
* <p/>
|
||||
* Basically, does it support syntax like
|
||||
* "... SET (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
|
||||
*
|
||||
* @return True if this SQL dialect is known to support "row value constructor" syntax in the SET clause; false otherwise.
|
||||
*/
|
||||
public boolean supportsRowValueConstructorSyntaxInSet() {
|
||||
return supportsRowValueConstructorSyntax();
|
||||
}
|
||||
|
||||
/**
|
||||
* If the dialect supports {@link #supportsRowValueConstructorSyntax() row values},
|
||||
* does it offer such support in IN lists as well?
|
||||
|
@ -457,6 +457,11 @@ public boolean supportsRowValueConstructorSyntax() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsRowValueConstructorSyntaxInSet() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls) {
|
||||
final StringBuilder orderByElement = new StringBuilder();
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.TypeMismatchException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
|
||||
import org.hibernate.hql.internal.ast.QuerySyntaxException;
|
||||
@ -81,13 +82,20 @@ protected final void mutateRowValueConstructorSyntaxesIfNecessary(Type lhsType,
|
||||
if ( lhsColumnSpan > 1 ) {
|
||||
// for dialects which are known to not support ANSI-SQL row-value-constructor syntax,
|
||||
// we should mutate the tree.
|
||||
if ( !sessionFactory.getDialect().supportsRowValueConstructorSyntax() ) {
|
||||
if ( !useRowValueConstructorSyntax( sessionFactory.getDialect() ) ) {
|
||||
mutateRowValueConstructorSyntax( lhsColumnSpan );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useRowValueConstructorSyntax(Dialect dialect) {
|
||||
if ( isInsideSetClause() ) {
|
||||
return dialect.supportsRowValueConstructorSyntaxInSet();
|
||||
}
|
||||
return dialect.supportsRowValueConstructorSyntax();
|
||||
}
|
||||
|
||||
private int getColumnSpan(Type type, SessionFactoryImplementor sfi) {
|
||||
int columnSpan = type.getColumnSpan( sfi );
|
||||
if ( columnSpan == 0 && type instanceof OneToOneType ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user