mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-20 01:55:02 +00:00
HHH-15585 Add support for DB2 aliases for schema validation
This commit is contained in:
parent
b1f92863cb
commit
fc0b19aceb
@ -25,6 +25,8 @@
|
|||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.QualifiedTableName;
|
import org.hibernate.boot.model.relational.QualifiedTableName;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.dialect.DB2Dialect;
|
||||||
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||||
import org.hibernate.engine.config.spi.StandardConverters;
|
import org.hibernate.engine.config.spi.StandardConverters;
|
||||||
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
||||||
@ -95,17 +97,21 @@ public AbstractInformationExtractorImpl(ExtractionContext extractionContext) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
extractionContext.getJdbcEnvironment().getDialect().augmentPhysicalTableTypes( physicalTableTypesList );
|
final Dialect dialect = extractionContext.getJdbcEnvironment().getDialect();
|
||||||
|
dialect.augmentPhysicalTableTypes( physicalTableTypesList );
|
||||||
this.extraPhysicalTableTypes = physicalTableTypesList.toArray( new String[0] );
|
this.extraPhysicalTableTypes = physicalTableTypesList.toArray( new String[0] );
|
||||||
|
|
||||||
final List<String> tableTypesList = new ArrayList<>();
|
final List<String> tableTypesList = new ArrayList<>();
|
||||||
tableTypesList.add( "TABLE" );
|
tableTypesList.add( "TABLE" );
|
||||||
tableTypesList.add( "VIEW" );
|
tableTypesList.add( "VIEW" );
|
||||||
if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings(), false ) ) {
|
if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings(), false ) ) {
|
||||||
|
if ( dialect instanceof DB2Dialect ) {
|
||||||
|
tableTypesList.add( "ALIAS" );
|
||||||
|
}
|
||||||
tableTypesList.add( "SYNONYM" );
|
tableTypesList.add( "SYNONYM" );
|
||||||
}
|
}
|
||||||
Collections.addAll( tableTypesList, extraPhysicalTableTypes );
|
Collections.addAll( tableTypesList, extraPhysicalTableTypes );
|
||||||
extractionContext.getJdbcEnvironment().getDialect().augmentRecognizedTableTypes( tableTypesList );
|
dialect.augmentRecognizedTableTypes( tableTypesList );
|
||||||
|
|
||||||
this.tableTypes = tableTypesList.toArray( new String[0] );
|
this.tableTypes = tableTypesList.toArray( new String[0] );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user