HHH-14794 : More changes to support SchemaMigrator/SchemaValidator using Hibernate Reactive

Changes required by SQL Server
This commit is contained in:
Gail Badner 2021-08-30 18:16:40 -07:00 committed by Sanne Grinovero
parent 24b9605c52
commit d17861d928
2 changed files with 21 additions and 1 deletions

View File

@ -49,7 +49,18 @@ public class SQLServer2012Dialect extends SQLServer2008Dialect {
@Override
public String getQuerySequencesString() {
// The upper-case name is necessary here so that both case-sensitive and case-insensitive collations work
return "select * from INFORMATION_SCHEMA.SEQUENCES";
// Internally, SQL server stores start_value, minimum_value, maximum_value, and increment
// in sql_variant columns. SQL Server's JDBC automatically converts these values
// to bigint. Vert.X does support sql_variant columns, so these columns need to be
// explicitly converted here.
return "select sequence_name, sequence_catalog, sequence_schema, " +
"convert( bigint, start_value ) as start_value, " +
"convert( bigint, minimum_value ) as minimum_value, " +
"convert( bigint, maximum_value ) as maximum_value, " +
"convert( bigint, increment ) as increment " +
"from INFORMATION_SCHEMA.SEQUENCES";
}
@Override

View File

@ -24,6 +24,7 @@ import org.hibernate.dialect.pagination.TopLimitHandler;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.StringType;
import org.hibernate.type.Type;
@ -117,6 +118,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException {
if ( dbMetaData == null ) {
// TODO: if DatabaseMetaData != null, unquoted case strategy is set to IdentifierCaseStrategy.UPPER
// Check to see if this setting is correct.
builder.setUnquotedCaseStrategy( IdentifierCaseStrategy.MIXED );
builder.setQuotedCaseStrategy( IdentifierCaseStrategy.MIXED );
}
@ -248,4 +251,10 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
return "";
}
}
@Override
public NameQualifierSupport getNameQualifierSupport() {
return NameQualifierSupport.BOTH;
}
}