From a70b99452649bed57804adef8455add8f349327d Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Mon, 16 Aug 2021 18:18:01 -0700 Subject: [PATCH] HHH-14744 : Refactor contextual information for SchemaManagementTool to be more easily extended by Hibernate Reactive 1. Add CockroachDB192Dialect#getNameQualifierSupport and #buildIdentifierHelper. 2. Change semantics for AbstractInformationExtractorImpl#processIndexInfoResultSet to be more friendly to subclasses. --- .../dialect/CockroachDB192Dialect.java | 23 +++++++++++++++++++ .../AbstractInformationExtractorImpl.java | 15 ++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDB192Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDB192Dialect.java index 18ad31c338..d0978cbe84 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDB192Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDB192Dialect.java @@ -28,6 +28,10 @@ import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.pagination.AbstractLimitHandler; import org.hibernate.dialect.pagination.LimitHandler; import org.hibernate.dialect.pagination.LimitHelper; +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.engine.spi.RowSelection; import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; @@ -658,4 +662,23 @@ public class CockroachDB192Dialect extends Dialect { public boolean canCreateSchema() { return false; } + + @Override + public NameQualifierSupport getNameQualifierSupport() { + // This method is overridden so the correct value will be returned when + // DatabaseMetaData is not available. + return NameQualifierSupport.SCHEMA; + } + + @Override + public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) + throws SQLException { + + if ( dbMetaData == null ) { + builder.setUnquotedCaseStrategy( IdentifierCaseStrategy.LOWER ); + builder.setQuotedCaseStrategy( IdentifierCaseStrategy.MIXED ); + } + + return super.buildIdentifierHelper( builder, dbMetaData ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java index 095af1afbf..6bb723c2c0 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java @@ -1029,18 +1029,13 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt * in conjunction with a table's index descriptions * *
  • - * {@link DatabaseMetaData#tableIndexClustered} - - * this is a clustered index - *
  • - *
  • - * {@link DatabaseMetaData#tableIndexHashed} - - * this is a hashed index - *
  • - *
  • - * {@link DatabaseMetaData#tableIndexOther} - - * this is some other style of index + * Any value other than {@link DatabaseMetaData#tableIndexStatistic} - + * this indicates that a table's index description + * (not statisics) is being returned. *
  • * + * NOTE: Hibernate ignores statistics and does not + * care about the actual type of index. * *
  • * column label {@link #getResultSetColumnNameLabel} -