Skip to content

Commit aaba476

Browse files
committed
Fix Sybase Connection#getSchema() throws an exception
1 parent c01734a commit aaba476

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
1414
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
1515
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
16+
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
1617
import org.hibernate.engine.spi.LoadQueryInfluencers;
1718
import org.hibernate.engine.spi.SessionFactoryImplementor;
1819
import org.hibernate.query.CastType;
@@ -287,4 +288,9 @@ public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, D
287288
return super.buildIdentifierHelper( builder, dbMetaData );
288289
}
289290

291+
@Override
292+
public NameQualifierSupport getNameQualifierSupport() {
293+
return NameQualifierSupport.CATALOG;
294+
}
295+
290296
}

hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ public TableInformation getTable(Identifier catalog, Identifier schema, Identifi
406406
}
407407

408408
private Identifier getCurrentSchema(JdbcEnvironment jdbcEnvironment) {
409+
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.CATALOG ) {
410+
return null;
411+
}
409412
if ( currentSchema != null ) {
410413
return currentSchema;
411414
}
@@ -427,6 +430,9 @@ private Identifier getCurrentSchema(JdbcEnvironment jdbcEnvironment) {
427430
}
428431

429432
private Identifier getCurrentCatalog(JdbcEnvironment jdbcEnvironment) {
433+
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.SCHEMA ) {
434+
return null;
435+
}
430436
if ( currentCatalog != null ) {
431437
return currentCatalog;
432438
}

0 commit comments

Comments
 (0)