Skip to content

Commit

Permalink
HHH-19219 Fix for Informix Catalog and schema support
Browse files Browse the repository at this point in the history
  • Loading branch information
VladoKuruc authored and beikov committed Mar 4, 2025
1 parent bf900c3 commit fbe192a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.hibernate.dialect.unique.UniqueDelegate;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
Expand Down Expand Up @@ -666,6 +667,11 @@ public String[] getDropSchemaCommand(String schemaName) {
return new String[] { "" };
}

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

@Override
public boolean useCrossReferenceForeignKeys(){
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
Expand Down Expand Up @@ -309,12 +310,17 @@ public void createSchema_fromSessionFactory() {

@Test
@SkipForDialect(value = SQLServerDialect.class,
comment = "SQL Server and Sybase support catalogs but their implementation of DatabaseMetaData"
comment = "SQL Server support catalogs but their implementation of DatabaseMetaData"
+ " throws exceptions when calling getSchemas/getTables with a non-existing catalog,"
+ " which results in nasty errors when generating an update script"
+ " and some catalogs don't exist.")
@SkipForDialect(value = SybaseDialect.class,
comment = "SQL Server and Sybase support catalogs but their implementation of DatabaseMetaData"
comment = "Sybase support catalogs but their implementation of DatabaseMetaData"
+ " throws exceptions when calling getSchemas/getTables with a non-existing catalog,"
+ " which results in nasty errors when generating an update script"
+ " and some catalogs don't exist.")
@SkipForDialect(value = InformixDialect.class,
comment = "Informix support catalogs but their implementation of DatabaseMetaData"
+ " throws exceptions when calling getSchemas/getTables with a non-existing catalog,"
+ " which results in nasty errors when generating an update script"
+ " and some catalogs don't exist.")
Expand Down Expand Up @@ -772,8 +778,8 @@ String patternStringForNameWithDifferentQualifier(String patternStringForName) {
}

private String patternStringForQualifier() {
return ( catalog != null ? Pattern.quote( catalog + "." ) : "" )
+ ( schema != null ? Pattern.quote( schema + "." ) : "" );
return ( catalog != null ? Pattern.quote( catalog ) + "." : "" )
+ ( schema != null ? Pattern.quote( schema ) + "." : "" );
}
}

Expand Down

0 comments on commit fbe192a

Please sign in to comment.