HHH-17763 Rely on action-specific `SchemaFilter` instances

Deprecated `ExecutionOptions#getSchemaFilter` which was always returning the default implementation (not filtering anything)
This commit is contained in:
Marco Belladelli 2024-02-26 12:44:34 +01:00
parent 89dfa61b0c
commit c956208926
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35
11 changed files with 82 additions and 75 deletions

View File

@ -244,7 +244,7 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
sqlGenerationContext, targets
);
tablesInformation.put( namespace, nameSpaceTablesInformation );
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
for ( Sequence sequence : namespace.getSequences() ) {
if ( contributableInclusionFilter.matches( sequence ) ) {
checkExportIdentifier( sequence, exportIdentifiers);
@ -259,10 +259,10 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
//NOTE : Foreign keys must be created *after* all tables of all namespaces for cross namespace fks. see HHH-10420
for ( Namespace namespace : database.getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
final NameSpaceTablesInformation nameSpaceTablesInformation = tablesInformation.get( namespace );
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table ) && contributableInclusionFilter.matches( table ) ) {
if ( schemaFilter.includeTable( table ) && contributableInclusionFilter.matches( table ) ) {
final TableInformation tableInformation = nameSpaceTablesInformation.getTableInformation( table );
if ( tableInformation == null || tableInformation.isPhysicalTable() ) {
applyForeignKeys( table, tableInformation, dialect, metadata, formatter, options,

View File

@ -93,15 +93,15 @@ public abstract class AbstractSchemaValidator implements SchemaValidator {
ContributableMatcher contributableInclusionFilter,
Dialect dialect) {
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
validateTables( metadata, databaseInformation, options, contributableInclusionFilter, dialect, namespace );
}
}
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
for ( Sequence sequence : namespace.getSequences() ) {
if ( ! options.getSchemaFilter().includeSequence( sequence ) ) {
if ( !schemaFilter.includeSequence( sequence ) ) {
continue;
}

View File

@ -55,7 +55,7 @@ public class GroupedSchemaMigratorImpl extends AbstractSchemaMigrator {
final NameSpaceTablesInformation tablesInformation =
new NameSpaceTablesInformation( metadata.getDatabase().getJdbcEnvironment().getIdentifierHelper() );
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
createSchemaAndCatalog(
existingDatabase,
options,
@ -71,7 +71,7 @@ public class GroupedSchemaMigratorImpl extends AbstractSchemaMigrator {
final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation( namespace );
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers );
@ -88,7 +88,7 @@ public class GroupedSchemaMigratorImpl extends AbstractSchemaMigrator {
}
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table );

View File

@ -40,7 +40,7 @@ public class GroupedSchemaValidatorImpl extends AbstractSchemaValidator {
final NameSpaceTablesInformation tables = databaseInformation.getTablesInformation( namespace );
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
validateTable(

View File

@ -55,7 +55,7 @@ public class IndividuallySchemaMigratorImpl extends AbstractSchemaMigrator {
final NameSpaceTablesInformation tablesInformation =
new NameSpaceTablesInformation( metadata.getDatabase().getJdbcEnvironment().getIdentifierHelper() );
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
createSchemaAndCatalog(
existingDatabase,
options,
@ -69,7 +69,7 @@ public class IndividuallySchemaMigratorImpl extends AbstractSchemaMigrator {
targets
);
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers );
@ -86,7 +86,7 @@ public class IndividuallySchemaMigratorImpl extends AbstractSchemaMigrator {
}
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
final TableInformation tableInformation = tablesInformation.getTableInformation( table );

View File

@ -39,7 +39,7 @@ public class IndividuallySchemaValidatorImpl extends AbstractSchemaValidator {
Dialect dialect,
Namespace namespace) {
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& table.isPhysicalTable()
&& contributableInclusionFilter.matches( table ) ) {
final TableInformation tableInformation = databaseInformation.getTableInformation(

View File

@ -230,15 +230,16 @@ public class SchemaCreatorImpl implements SchemaCreator {
final SqlStringGenerationContext context = createSqlStringGenerationContext(options, metadata);
final Set<String> exportIdentifiers = setOfSize(50);
createSchemasAndCatalogs(metadata, options, dialect, formatter, context, targets);
createSchemasAndCatalogs(metadata, options, schemaFilter, dialect, formatter, context, targets);
// next, create all "before table" auxiliary objects
createAuxiliaryObjectsBeforeTables(metadata, options, dialect, formatter, context, exportIdentifiers, targets);
// next, create all UDTs
createUserDefinedTypes(metadata, options, dialect, formatter, context, targets);
createUserDefinedTypes(metadata, options, schemaFilter, dialect, formatter, context, targets);
// then, create all schema objects (tables, sequences, constraints, etc) in each schema
createSequencesTablesConstraints(
metadata,
options,
schemaFilter,
contributableInclusionMatcher,
dialect,
formatter,
@ -247,7 +248,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
targets
);
// foreign keys must be created after all tables of all namespaces for cross-namespace constraints (see HHH-10420)
createForeignKeys( metadata, options, contributableInclusionMatcher, dialect, formatter, context, targets );
createForeignKeys( metadata, options, schemaFilter, contributableInclusionMatcher, dialect, formatter, context, targets );
// next, create all "after table" auxiliary objects
createAuxiliaryObjectsAfterTables( metadata, options, dialect, formatter, context, exportIdentifiers, targets );
// and finally add all init commands
@ -287,6 +288,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createForeignKeys(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionMatcher,
Dialect dialect,
Formatter formatter,
@ -294,9 +296,9 @@ public class SchemaCreatorImpl implements SchemaCreator {
GenerationTarget[] targets) {
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
// foreign keys must be created after unique keys for numerous DBs (see HHH-8390)
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
for ( Table table : namespace.getTables() ) {
if ( options.getSchemaFilter().includeTable( table )
if ( schemaFilter.includeTable( table )
&& contributableInclusionMatcher.matches( table ) ) {
// foreign keys
for ( ForeignKey foreignKey : table.getForeignKeys().values() ) {
@ -316,6 +318,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createSequencesTablesConstraints(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionMatcher,
Dialect dialect,
Formatter formatter,
@ -323,11 +326,12 @@ public class SchemaCreatorImpl implements SchemaCreator {
Set<String> exportIdentifiers,
GenerationTarget[] targets) {
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
// sequences
createSequences(
metadata,
options,
schemaFilter,
contributableInclusionMatcher,
dialect,
formatter,
@ -340,6 +344,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
createTables(
metadata,
options,
schemaFilter,
contributableInclusionMatcher,
dialect,
formatter,
@ -351,6 +356,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
createTableConstraints(
metadata,
options,
schemaFilter,
contributableInclusionMatcher,
dialect,
formatter,
@ -366,6 +372,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createTableConstraints(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionMatcher,
Dialect dialect,
Formatter formatter,
@ -375,7 +382,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
Namespace namespace) {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& contributableInclusionMatcher.matches( table ) ) {
// indexes
for ( Index index : table.getIndexes().values() ) {
@ -404,6 +411,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createTables(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionMatcher,
Dialect dialect,
Formatter formatter,
@ -414,7 +422,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& !table.isView()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& contributableInclusionMatcher.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers );
applySqlStrings(
@ -428,7 +436,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& table.isView()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& contributableInclusionMatcher.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers );
applySqlStrings(
@ -444,6 +452,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createSequences(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionMatcher,
Dialect dialect,
Formatter formatter,
@ -452,7 +461,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
GenerationTarget[] targets,
Namespace namespace) {
for ( Sequence sequence : namespace.getSequences() ) {
if ( options.getSchemaFilter().includeSequence( sequence )
if ( schemaFilter.includeSequence( sequence )
&& contributableInclusionMatcher.matches( sequence ) ) {
checkExportIdentifier( sequence, exportIdentifiers);
applySqlStrings(
@ -491,12 +500,13 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createUserDefinedTypes(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
Dialect dialect,
Formatter formatter,
SqlStringGenerationContext context,
GenerationTarget[] targets) {
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
for ( UserDefinedType userDefinedType : namespace.getDependencyOrderedUserDefinedTypes() ) {
applySqlStrings(
dialect.getUserDefinedTypeExporter()
@ -513,6 +523,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
private static void createSchemasAndCatalogs(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
Dialect dialect,
Formatter formatter,
SqlStringGenerationContext context,
@ -523,7 +534,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
if ( tryToCreateCatalogs || tryToCreateSchemas ) {
Set<Identifier> exportedCatalogs = new HashSet<>();
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
Namespace.Name logicalName = namespace.getName();
Namespace.Name physicalName = namespace.getPhysicalName();
@ -738,11 +749,6 @@ public class SchemaCreatorImpl implements SchemaCreator {
public ExceptionHandler getExceptionHandler() {
return ExceptionHandlerHaltImpl.INSTANCE;
}
@Override
public SchemaFilter getSchemaFilter() {
return schemaFilter;
}
};
createFromMetadata( metadata, options, dialect, FormatStyle.NONE.getFormatter(), target );
@ -798,11 +804,6 @@ public class SchemaCreatorImpl implements SchemaCreator {
public ExceptionHandler getExceptionHandler() {
return ExceptionHandlerLoggedImpl.INSTANCE;
}
@Override
public SchemaFilter getSchemaFilter() {
return schemaFilter;
}
},
(contributed) -> true,
new SourceDescriptor() {

View File

@ -222,8 +222,8 @@ public class SchemaDropperImpl implements SchemaDropper {
targets
);
dropAuxiliaryObjectsAfterTables( metadata, options, dialect, formatter, context, targets );
dropUserDefinedTypes( metadata, options, dialect, formatter, context, targets );
dropSchemasAndCatalogs( metadata, options, dialect, formatter, context, targets );
dropUserDefinedTypes( metadata, options, schemaFilter, dialect, formatter, context, targets );
dropSchemasAndCatalogs( metadata, options, schemaFilter, dialect, formatter, context, targets );
}
private void dropConstraintsTablesSequences(
@ -236,7 +236,7 @@ public class SchemaDropperImpl implements SchemaDropper {
GenerationTarget[] targets) {
final Set<String> exportIdentifiers = setOfSize( 50 );
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
// we need to drop all constraints/indexes prior to dropping the tables
applyConstraintDropping(
@ -253,6 +253,7 @@ public class SchemaDropperImpl implements SchemaDropper {
dropTables(
metadata,
options,
schemaFilter,
inclusionFilter,
dialect,
formatter,
@ -265,6 +266,7 @@ public class SchemaDropperImpl implements SchemaDropper {
dropSequences(
metadata,
options,
schemaFilter,
inclusionFilter,
dialect,
formatter,
@ -323,6 +325,7 @@ public class SchemaDropperImpl implements SchemaDropper {
private static void dropSequences(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher inclusionFilter,
Dialect dialect,
Formatter formatter,
@ -331,7 +334,7 @@ public class SchemaDropperImpl implements SchemaDropper {
Namespace namespace,
GenerationTarget[] targets) {
for ( Sequence sequence : namespace.getSequences() ) {
if ( options.getSchemaFilter().includeSequence( sequence )
if ( schemaFilter.includeSequence( sequence )
&& inclusionFilter.matches( sequence ) ) {
checkExportIdentifier( sequence, exportIdentifiers);
applySqlStrings(
@ -347,6 +350,7 @@ public class SchemaDropperImpl implements SchemaDropper {
private static void dropTables(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher inclusionFilter,
Dialect dialect,
Formatter formatter,
@ -357,7 +361,7 @@ public class SchemaDropperImpl implements SchemaDropper {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& table.isView()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& inclusionFilter.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers);
applySqlStrings(
@ -371,7 +375,7 @@ public class SchemaDropperImpl implements SchemaDropper {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& !table.isView()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& inclusionFilter.matches( table ) ) {
checkExportIdentifier( table, exportIdentifiers);
applySqlStrings(
@ -387,12 +391,13 @@ public class SchemaDropperImpl implements SchemaDropper {
private static void dropUserDefinedTypes(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
Dialect dialect,
Formatter formatter,
SqlStringGenerationContext context,
GenerationTarget[] targets) {
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
final List<UserDefinedType> dependencyOrderedUserDefinedTypes = namespace.getDependencyOrderedUserDefinedTypes();
Collections.reverse( dependencyOrderedUserDefinedTypes );
for ( UserDefinedType userDefinedType : dependencyOrderedUserDefinedTypes ) {
@ -411,6 +416,7 @@ public class SchemaDropperImpl implements SchemaDropper {
private static void dropSchemasAndCatalogs(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
Dialect dialect,
Formatter formatter,
SqlStringGenerationContext context,
@ -420,7 +426,7 @@ public class SchemaDropperImpl implements SchemaDropper {
if ( tryToDropCatalogs || tryToDropSchemas) {
final Set<Identifier> exportedCatalogs = new HashSet<>();
for ( Namespace namespace : metadata.getDatabase().getNamespaces() ) {
if ( options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( schemaFilter.includeNamespace( namespace ) ) {
Namespace.Name logicalName = namespace.getName();
Namespace.Name physicalName = namespace.getPhysicalName();
@ -464,7 +470,7 @@ public class SchemaDropperImpl implements SchemaDropper {
if ( dialect.dropConstraints() ) {
for ( Table table : namespace.getTables() ) {
if ( table.isPhysicalTable()
&& options.getSchemaFilter().includeTable( table )
&& schemaFilter.includeTable( table )
&& inclusionFilter.matches( table ) ) {
for ( ForeignKey foreignKey : table.getForeignKeys().values() ) {
applySqlStrings(
@ -552,11 +558,6 @@ public class SchemaDropperImpl implements SchemaDropper {
public ExceptionHandler getExceptionHandler() {
return ExceptionHandlerLoggedImpl.INSTANCE;
}
@Override
public SchemaFilter getSchemaFilter() {
return schemaFilter;
}
},
(contributed) -> true,
serviceRegistry.getService( JdbcEnvironment.class ).getDialect(),

View File

@ -58,9 +58,11 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
private static final Logger log = Logger.getLogger( SchemaTruncatorImpl.class );
private final HibernateSchemaManagementTool tool;
private final SchemaFilter schemaFilter;
public SchemaTruncatorImpl(HibernateSchemaManagementTool tool, SchemaFilter truncatorFilter) {
this.tool = tool;
schemaFilter = truncatorFilter;
}
@Override
@ -111,12 +113,13 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
final boolean format = Helper.interpretFormattingEnabled( options.getConfigurationValues() );
final Formatter formatter = format ? FormatStyle.DDL.getFormatter() : FormatStyle.NONE.getFormatter();
truncateFromMetadata( metadata, options, contributableInclusionFilter, dialect, formatter, targets );
truncateFromMetadata( metadata, options, schemaFilter, contributableInclusionFilter, dialect, formatter, targets );
}
private void truncateFromMetadata(
Metadata metadata,
ExecutionOptions options,
SchemaFilter schemaFilter,
ContributableMatcher contributableInclusionFilter,
Dialect dialect,
Formatter formatter,
@ -128,11 +131,11 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
for ( Namespace namespace : database.getNamespaces() ) {
if ( ! options.getSchemaFilter().includeNamespace( namespace ) ) {
if ( ! schemaFilter.includeNamespace( namespace ) ) {
continue;
}
disableConstraints( namespace, metadata, formatter, options, context,
disableConstraints( namespace, metadata, formatter, options, schemaFilter, context,
contributableInclusionFilter, targets );
applySqlString( dialect.getTableCleaner().getSqlBeforeString(), formatter, options,targets );
@ -142,7 +145,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
if ( ! table.isPhysicalTable() ) {
continue;
}
if ( ! options.getSchemaFilter().includeTable( table ) ) {
if ( ! schemaFilter.includeTable( table ) ) {
continue;
}
if ( ! contributableInclusionFilter.matches( table ) ) {
@ -172,7 +175,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
// }
applySqlString( dialect.getTableCleaner().getSqlAfterString(), formatter, options,targets );
enableConstraints( namespace, metadata, formatter, options, context,
enableConstraints( namespace, metadata, formatter, options, schemaFilter, context,
contributableInclusionFilter, targets );
}
@ -186,6 +189,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
Metadata metadata,
Formatter formatter,
ExecutionOptions options,
SchemaFilter schemaFilter,
SqlStringGenerationContext context,
ContributableMatcher contributableInclusionFilter,
GenerationTarget... targets) {
@ -195,7 +199,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
if ( !table.isPhysicalTable() ) {
continue;
}
if ( ! options.getSchemaFilter().includeTable( table ) ) {
if ( ! schemaFilter.includeTable( table ) ) {
continue;
}
if ( ! contributableInclusionFilter.matches( table ) ) {
@ -232,6 +236,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
Metadata metadata,
Formatter formatter,
ExecutionOptions options,
SchemaFilter schemaFilter,
SqlStringGenerationContext context,
ContributableMatcher contributableInclusionFilter,
GenerationTarget... targets) {
@ -241,7 +246,7 @@ public class SchemaTruncatorImpl implements SchemaTruncator {
if ( !table.isPhysicalTable() ) {
continue;
}
if ( ! options.getSchemaFilter().includeTable( table ) ) {
if ( ! schemaFilter.includeTable( table ) ) {
continue;
}
if ( ! contributableInclusionFilter.matches( table ) ) {

View File

@ -24,5 +24,11 @@ public interface ExecutionOptions {
ExceptionHandler getExceptionHandler();
SchemaFilter getSchemaFilter();
/**
* @deprecated No longer used, see {@link org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_FILTER_PROVIDER}
*/
@Deprecated( forRemoval = true )
default SchemaFilter getSchemaFilter() {
throw new UnsupportedOperationException();
}
}

View File

@ -23,7 +23,6 @@ import org.hibernate.service.ServiceRegistry;
import org.hibernate.tool.schema.Action;
import org.hibernate.tool.schema.SourceType;
import org.hibernate.tool.schema.TargetType;
import org.hibernate.tool.schema.internal.DefaultSchemaFilter;
import org.hibernate.tool.schema.internal.ExceptionHandlerHaltImpl;
import org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl;
import org.hibernate.tool.schema.internal.Helper;
@ -173,17 +172,6 @@ public class SchemaManagementToolCoordinator {
public static ExecutionOptions buildExecutionOptions(
final Map<String,Object> configurationValues,
final ExceptionHandler exceptionHandler) {
return buildExecutionOptions(
configurationValues,
DefaultSchemaFilter.INSTANCE,
exceptionHandler
);
}
public static ExecutionOptions buildExecutionOptions(
final Map<String,Object> configurationValues,
final SchemaFilter schemaFilter,
final ExceptionHandler exceptionHandler) {
return new ExecutionOptions() {
@Override
public boolean shouldManageNamespaces() {
@ -199,14 +187,20 @@ public class SchemaManagementToolCoordinator {
public ExceptionHandler getExceptionHandler() {
return exceptionHandler;
}
@Override
public SchemaFilter getSchemaFilter() {
return schemaFilter;
}
};
}
/**
* @deprecated Use {@link #buildExecutionOptions(Map, ExceptionHandler)} instead.
*/
@Deprecated(forRemoval = true)
public static ExecutionOptions buildExecutionOptions(
final Map<String,Object> configurationValues,
final SchemaFilter schemaFilter,
final ExceptionHandler exceptionHandler) {
return buildExecutionOptions( configurationValues, exceptionHandler );
}
private static void performDatabaseAction(
final Action action,
Metadata metadata,