HHH-14242 Fix issue for Dialects supporting row value constructor Syntax but not in the SET clause
This commit is contained in:
parent
e7bcc03ede
commit
cf9d4ec3b3
|
@ -2450,6 +2450,19 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return false;
|
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},
|
* If the dialect supports {@link #supportsRowValueConstructorSyntax() row values},
|
||||||
* does it offer such support in IN lists as well?
|
* does it offer such support in IN lists as well?
|
||||||
|
|
|
@ -457,6 +457,11 @@ public class MySQLDialect extends Dialect {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsRowValueConstructorSyntaxInSet() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls) {
|
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls) {
|
||||||
final StringBuilder orderByElement = new StringBuilder();
|
final StringBuilder orderByElement = new StringBuilder();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.TypeMismatchException;
|
import org.hibernate.TypeMismatchException;
|
||||||
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
|
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
|
||||||
import org.hibernate.hql.internal.ast.QuerySyntaxException;
|
import org.hibernate.hql.internal.ast.QuerySyntaxException;
|
||||||
|
@ -81,13 +82,20 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
||||||
if ( lhsColumnSpan > 1 ) {
|
if ( lhsColumnSpan > 1 ) {
|
||||||
// for dialects which are known to not support ANSI-SQL row-value-constructor syntax,
|
// for dialects which are known to not support ANSI-SQL row-value-constructor syntax,
|
||||||
// we should mutate the tree.
|
// we should mutate the tree.
|
||||||
if ( !sessionFactory.getDialect().supportsRowValueConstructorSyntax() ) {
|
if ( !useRowValueConstructorSyntax( sessionFactory.getDialect() ) ) {
|
||||||
mutateRowValueConstructorSyntax( lhsColumnSpan );
|
mutateRowValueConstructorSyntax( lhsColumnSpan );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean useRowValueConstructorSyntax(Dialect dialect) {
|
||||||
|
if ( isInsideSetClause() ) {
|
||||||
|
return dialect.supportsRowValueConstructorSyntaxInSet();
|
||||||
|
}
|
||||||
|
return dialect.supportsRowValueConstructorSyntax();
|
||||||
|
}
|
||||||
|
|
||||||
private int getColumnSpan(Type type, SessionFactoryImplementor sfi) {
|
private int getColumnSpan(Type type, SessionFactoryImplementor sfi) {
|
||||||
int columnSpan = type.getColumnSpan( sfi );
|
int columnSpan = type.getColumnSpan( sfi );
|
||||||
if ( columnSpan == 0 && type instanceof OneToOneType ) {
|
if ( columnSpan == 0 && type instanceof OneToOneType ) {
|
||||||
|
|
Loading…
Reference in New Issue