HHH-11598 - Use the default catalog when scanning the tables for hbm2ddl schema migration

This commit is contained in:
Vlad Mihalcea 2017-03-28 15:35:05 +03:00
parent 1ce9e24b26
commit e6d2ff4ac4
3 changed files with 20 additions and 6 deletions

View File

@ -418,7 +418,15 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
if ( extractionContext.getJdbcEnvironment().getNameQualifierSupport().supportsCatalogs() ) {
if ( catalog == null ) {
catalogFilter = "";
String defaultCatalog = "";
if ( extractionContext.getJdbcEnvironment().getNameQualifierSupport().supportsCatalogs() ) {
try {
defaultCatalog = extractionContext.getJdbcConnection().getCatalog();
}
catch (SQLException ignore) {
}
}
catalogFilter = defaultCatalog;
}
else {
catalogToUse = catalog;

View File

@ -163,6 +163,12 @@ public class CrossSchemaForeignKeyGenerationTest extends BaseUnitTestCase {
TargetDescriptorImpl.INSTANCE
);
new IndividuallySchemaMigratorImpl( tool, DefaultSchemaFilter.INSTANCE ).doMigration(
metadata,
options,
TargetDescriptorImpl.INSTANCE
);
new SchemaDropperImpl( tool ).doDrop(
metadata,
options,

View File

@ -93,14 +93,14 @@ ext {
h2: "com.h2database:h2:${h2Version}",
hsqldb: "org.hsqldb:hsqldb:2.3.2",
derby: "org.apache.derby:derby:10.11.1.1",
postgresql: 'org.postgresql:postgresql:9.4-1202-jdbc41',
mysql: 'mysql:mysql-connector-java:6.0.5',
postgresql: 'org.postgresql:postgresql:9.4.1212',
mysql: 'mysql:mysql-connector-java:6.0.5',
mariadb: 'org.mariadb.jdbc:mariadb-java-client:1.5.7',
oracle: 'com.oracle.ojdbc:ojdbc7:12.1.0.2.0',
mssql: 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8',
oracle: 'com.oracle.jdbc:ojdbc7:12.1.0.2',
mssql: 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8',
informix: 'com.ibm.informix:jdbc:4.10.7.20160517',
informix: 'com.ibm.informix:jdbc:4.10.7.20160517',
jboss_jta: "org.jboss.jbossts:jbossjta:4.16.4.Final",
xapool: "com.experlog:xapool:1.5.0",
mockito: 'org.mockito:mockito-core:2.7.5',