Top Description Fields Constructors Methods
org.hibernate.tool.schema.internal

public abstract Class AbstractSchemaMigrator

extends Object
implements SchemaMigrator
Class Inheritance
All Implemented Interfaces
org.hibernate.tool.schema.spi.SchemaMigrator
Known Direct Subclasses
org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl, org.hibernate.tool.schema.internal.IndividuallySchemaMigratorImpl
Imports
java.util.HashMap, .HashSet, .Map, .Set, java.util.stream.StreamSupport, org.hibernate.boot.Metadata, org.hibernate.boot.model.naming.Identifier, org.hibernate.boot.model.relational.AuxiliaryDatabaseObject, .Database, .Exportable, .Namespace, .Sequence, .SqlStringGenerationContext, org.hibernate.boot.model.relational.internal.SqlStringGenerationContextImpl, org.hibernate.dialect.Dialect, org.hibernate.engine.config.spi.ConfigurationService, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment, org.hibernate.engine.jdbc.internal.FormatStyle, .Formatter, org.hibernate.internal.util.StringHelper, org.hibernate.internal.util.collections.CollectionHelper, org.hibernate.mapping.Constraint, .ForeignKey, .Index, .Table, .UniqueKey, org.hibernate.resource.transaction.spi.DdlTransactionIsolator, org.hibernate.tool.schema.UniqueConstraintSchemaUpdateStrategy, org.hibernate.tool.schema.extract.spi.ColumnInformation, .DatabaseInformation, .IndexInformation, .NameSpaceTablesInformation, .SequenceInformation, .TableInformation, org.hibernate.tool.schema.internal.exec.GenerationTarget, .JdbcContext, org.hibernate.tool.schema.spi.CommandAcceptanceException, .ContributableMatcher, .ExecutionOptions, .Exporter, .SchemaFilter, .SchemaManagementException, .SchemaMigrator, .TargetDescriptor, org.jboss.logging.Logger

Base implementation of SchemaMigrator.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final Logger
protected SchemaFilter
protected HibernateSchemaManagementTool
private UniqueConstraintSchemaUpdateStrategy

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
applyForeignKeys(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
protected void
applyIndexes(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
private static void
applySequence(Sequence sequence, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
private static void
applySqlString(boolean quiet, String sql, Formatter formatter, ExecutionOptions options, GenerationTarget... targets)

protected static void
applySqlStrings(boolean quiet, String[] sqlStrings, Formatter formatter, ExecutionOptions options, GenerationTarget... targets)

protected void
applyUniqueKeys(Table table, TableInformation tableInfo, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
protected void
checkExportIdentifier(Exportable exportable, Set<String> exportIdentifiers)

private boolean

Returns:

boolean, true if key already exists
checkForExistingForeignKey
(ForeignKey
- ForeignKey, new key to be created
foreignKey
,
TableInformation
- TableInformation, information of existing keys
tableInformation
)

Check if the ForeignKey already exists.

protected void
createSchemaAndCatalog(DatabaseInformation existingDatabase, ExecutionOptions options, Dialect dialect, Formatter formatter, boolean tryToCreateCatalogs, boolean tryToCreateSchemas, Set<Identifier> exportedCatalogs, Namespace namespace, SqlStringGenerationContext context, GenerationTarget[] targets)

protected void
createTable(Table table, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
private UniqueConstraintSchemaUpdateStrategy
public void
doMigration(Metadata
Represents the schema to be altered.
metadata
,
ExecutionOptions
Options for executing the alteration
options
,
ContributableMatcher
Filter for Contributable instances to use
contributableInclusionFilter
,
TargetDescriptor
description of the target(s) for the alteration commands
targetDescriptor
)

Implements org.hibernate.tool.schema.spi.SchemaMigrator.doMigration.

Deprecated as a consequence of Metadata being deprecated.
Perform a schema migration (alteration) from the indicated source(s) to the indicated target(s).
pack-priv boolean
equivalentForeignKeyExistsInDatabase(TableInformation tableInformation, String referencingColumn, String referencedTable)

private IndexInformation
findMatchingIndex(Index index, TableInformation tableInformation)

protected void
migrateTable(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
private void
performMigration(Metadata metadata, DatabaseInformation existingDatabase, ExecutionOptions options, ContributableMatcher contributableInclusionFilter, Dialect dialect, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated as a consequence of Metadata being deprecated.
protected abstract NameSpaceTablesInformation
performTablesMigration(Metadata metadata, DatabaseInformation existingDatabase, ExecutionOptions options, ContributableMatcher contributableInclusionFilter, Dialect dialect, Formatter formatter, Set<String> exportIdentifiers, boolean tryToCreateCatalogs, boolean tryToCreateSchemas, Set<Identifier> exportedCatalogs, Namespace namespace, SqlStringGenerationContext sqlGenerationContext, GenerationTarget[] targets)

Deprecated as a consequence of Metadata being deprecated.
public void
private SqlStringGenerationContext
sqlGenerationContext(Metadata metadata, ExecutionOptions options)

Deprecated as a consequence of Metadata being deprecated.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Logger log
schemaFilterback to summary
protected SchemaFilter schemaFilter
toolback to summary
protected HibernateSchemaManagementTool tool
uniqueConstraintStrategyback to summary
private UniqueConstraintSchemaUpdateStrategy uniqueConstraintStrategy

Constructor Detail

AbstractSchemaMigratorback to summary
public AbstractSchemaMigrator(HibernateSchemaManagementTool tool, SchemaFilter schemaFilter)

Method Detail

applyForeignKeysback to summary
protected void applyForeignKeys(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

applyIndexesback to summary
protected void applyIndexes(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

applySequenceback to summary
private static void applySequence(Sequence sequence, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

applySqlStringback to summary
private static void applySqlString(boolean quiet, String sql, Formatter formatter, ExecutionOptions options, GenerationTarget... targets)
applySqlStringsback to summary
protected static void applySqlStrings(boolean quiet, String[] sqlStrings, Formatter formatter, ExecutionOptions options, GenerationTarget... targets)
applyUniqueKeysback to summary
protected void applyUniqueKeys(Table table, TableInformation tableInfo, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

checkExportIdentifierback to summary
protected void checkExportIdentifier(Exportable exportable, Set<String> exportIdentifiers)
checkForExistingForeignKeyback to summary
private boolean checkForExistingForeignKey(ForeignKey foreignKey, TableInformation tableInformation)

Check if the ForeignKey already exists. First check based on definition and if that is not matched check if a key with the exact same name exists. Keys with the same name are presumed to be functional equal.

Parameters
foreignKey:ForeignKey

- ForeignKey, new key to be created

tableInformation:TableInformation

- TableInformation, information of existing keys

Returns:boolean

boolean, true if key already exists

createSchemaAndCatalogback to summary
protected void createSchemaAndCatalog(DatabaseInformation existingDatabase, ExecutionOptions options, Dialect dialect, Formatter formatter, boolean tryToCreateCatalogs, boolean tryToCreateSchemas, Set<Identifier> exportedCatalogs, Namespace namespace, SqlStringGenerationContext context, GenerationTarget[] targets)
createTableback to summary
protected void createTable(Table table, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

determineUniqueConstraintSchemaUpdateStrategyback to summary
private UniqueConstraintSchemaUpdateStrategy determineUniqueConstraintSchemaUpdateStrategy()
doMigrationback to summary
public void doMigration(Metadata metadata, ExecutionOptions options, ContributableMatcher contributableInclusionFilter, TargetDescriptor targetDescriptor)

Implements org.hibernate.tool.schema.spi.SchemaMigrator.doMigration.

Doc from org.hibernate.tool.schema.spi.SchemaMigrator.doMigration.

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

Perform a schema migration (alteration) from the indicated source(s) to the indicated target(s).

Parameters
metadata:Metadata

Represents the schema to be altered.

options:ExecutionOptions

Options for executing the alteration

contributableInclusionFilter:ContributableMatcher

Filter for Contributable instances to use

targetDescriptor:TargetDescriptor

description of the target(s) for the alteration commands

Annotations
@Override
equivalentForeignKeyExistsInDatabaseback to summary
pack-priv boolean equivalentForeignKeyExistsInDatabase(TableInformation tableInformation, String referencingColumn, String referencedTable)
findMatchingIndexback to summary
private IndexInformation findMatchingIndex(Index index, TableInformation tableInformation)
migrateTableback to summary
protected void migrateTable(Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

performMigrationback to summary
private void performMigration(Metadata metadata, DatabaseInformation existingDatabase, ExecutionOptions options, ContributableMatcher contributableInclusionFilter, Dialect dialect, SqlStringGenerationContext sqlGenerationContext, GenerationTarget... targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

performTablesMigrationback to summary
protected abstract NameSpaceTablesInformation performTablesMigration(Metadata metadata, DatabaseInformation existingDatabase, ExecutionOptions options, ContributableMatcher contributableInclusionFilter, Dialect dialect, Formatter formatter, Set<String> exportIdentifiers, boolean tryToCreateCatalogs, boolean tryToCreateSchemas, Set<Identifier> exportedCatalogs, Namespace namespace, SqlStringGenerationContext sqlGenerationContext, GenerationTarget[] targets)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.

setUniqueConstraintStrategyback to summary
public void setUniqueConstraintStrategy(UniqueConstraintSchemaUpdateStrategy uniqueConstraintStrategy)

For testing.

sqlGenerationContextback to summary
private SqlStringGenerationContext sqlGenerationContext(Metadata metadata, ExecutionOptions options)

Deprecated

as a consequence of Metadata being deprecated. See corresponding docs for further information.