Skip to content

Commit

Permalink
HHH-14794 : More changes to support SchemaMigrator/SchemaValidator us…
Browse files Browse the repository at this point in the history
…ing Hibernate Reactive

Changes required by SQL Server
  • Loading branch information
gbadner authored and Sanne committed Sep 17, 2021
1 parent 24b9605 commit d17861d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Expand Up @@ -49,7 +49,18 @@ public String getSequenceNextValString(String sequenceName) {
@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
Expand Down
Expand Up @@ -24,6 +24,7 @@
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;
Expand Down Expand Up @@ -117,6 +118,8 @@ public IdentifierHelper buildIdentifierHelper(
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 );
}
Expand Down Expand Up @@ -248,4 +251,10 @@ public String getCreateTemporaryTableColumnAnnotation(int sqlTypeCode) {
return "";
}
}

@Override
public NameQualifierSupport getNameQualifierSupport() {
return NameQualifierSupport.BOTH;
}

}

0 comments on commit d17861d

Please sign in to comment.