Class SchemaManagerImpl
java.lang.Object
org.hibernate.relational.internal.SchemaManagerImpl
- All Implemented Interfaces:
SchemaManager
,SchemaManager
Implementation of
SchemaManager
, backed by a SessionFactoryImplementor
and SchemaManagementToolCoordinator
.-
Constructor Summary
ConstructorsConstructorDescriptionSchemaManagerImpl
(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) SchemaManagerImpl
(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata, String schemaName, String catalogName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(boolean createSchemas) void
drop
(boolean dropSchemas) void
dropMappedObjects
(boolean dropSchemas) Drop database objects mapped by Hibernate entities, undoing the previous export.void
exportMappedObjects
(boolean createSchemas) Export database objects mapped by Hibernate entities, and then import initial data from/import.sql
and any other configured load script.forCatalog
(String catalogName) Obtain an instance which targets the given catalog.Obtain an instance which targets the given schema.void
populate()
Populate the database by executing/import.sql
and any other configured load script.void
truncate()
void
Truncate the database tables mapped by Hibernate entities, and then reimport initial data from/import.sql
and any other configured load script.void
validate()
void
Validate that the database objects mapped by Hibernate entities have the expected definitions.
-
Constructor Details
-
SchemaManagerImpl
-
SchemaManagerImpl
public SchemaManagerImpl(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata, String schemaName, String catalogName)
-
-
Method Details
-
forSchema
Description copied from interface:SchemaManager
Obtain an instance which targets the given schema.This is especially useful when using multiple schemas, for example, in schema-based multitenancy.
- Specified by:
forSchema
in interfaceSchemaManager
- Parameters:
schemaName
- The name of the schema to target
-
forCatalog
Description copied from interface:SchemaManager
Obtain an instance which targets the given catalog.- Specified by:
forCatalog
in interfaceSchemaManager
- Parameters:
catalogName
- The name of the catalog to target
-
exportMappedObjects
public void exportMappedObjects(boolean createSchemas) Description copied from interface:SchemaManager
Export database objects mapped by Hibernate entities, and then import initial data from/import.sql
and any other configured load script.Programmatic way to run
SchemaCreator
.- Specified by:
exportMappedObjects
in interfaceSchemaManager
- Parameters:
createSchemas
- iftrue
, attempt to create schemas, otherwise, assume the schemas already exist
-
dropMappedObjects
public void dropMappedObjects(boolean dropSchemas) Description copied from interface:SchemaManager
Drop database objects mapped by Hibernate entities, undoing the previous export.Programmatic way to run
SchemaDropper
.- Specified by:
dropMappedObjects
in interfaceSchemaManager
- Parameters:
dropSchemas
- iftrue
, drop schemas, otherwise, leave them be
-
validateMappedObjects
public void validateMappedObjects()Description copied from interface:SchemaManager
Validate that the database objects mapped by Hibernate entities have the expected definitions.Programmatic way to run
SchemaValidator
.- Specified by:
validateMappedObjects
in interfaceSchemaManager
-
truncateMappedObjects
public void truncateMappedObjects()Description copied from interface:SchemaManager
Truncate the database tables mapped by Hibernate entities, and then reimport initial data from/import.sql
and any other configured load script.Programmatic way to run
SchemaTruncator
.This operation does not affect the second-level cache. Therefore, after calling
truncate()
, it might be necessary to also callCache.evictAllRegions()
to clean up data held in the second-level cache.- Specified by:
truncateMappedObjects
in interfaceSchemaManager
-
populate
public void populate()Description copied from interface:SchemaManager
Populate the database by executing/import.sql
and any other configured load script.Programmatic way to run
SchemaPopulator
.- Specified by:
populate
in interfaceSchemaManager
- See Also:
-
create
public void create(boolean createSchemas) - Specified by:
create
in interfaceSchemaManager
-
drop
public void drop(boolean dropSchemas) - Specified by:
drop
in interfaceSchemaManager
-
validate
- Specified by:
validate
in interfaceSchemaManager
- Throws:
SchemaValidationException
-
truncate
public void truncate()- Specified by:
truncate
in interfaceSchemaManager
-