Class TableCreator
java.lang.Object
org.eclipse.persistence.tools.schemaframework.TableCreator
Purpose: This class is responsible for creating the tables defined in the project.
A specific subclass of this class is created for each project. The specific table information
is defined in the subclass.
- Author:
- Peter Krogh
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanFlag to disable table existence check before create.static final StringDefault identity generator sequence name.protected booleanprotected Stringprotected List<TableDefinition> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTableDefinition(TableDefinition tableDefinition) Add the table.voidaddTableDefinitions(Collection<TableDefinition> tableDefs) Add a set of tables.protected voidbuildConstraints(SchemaManager schemaManager, boolean build) Convert any field constraint to constraint objects.voidcreateConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build) Create constraints.voidcreateConstraints(DatabaseSession session) Create constraints.voidcreateConstraints(DatabaseSession session, SchemaManager schemaManager) Create constraints.voidcreateConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build) Create constraints.voidcreateTables(DatabaseSession session) This creates the tables on the database.voidcreateTables(DatabaseSession session, SchemaManager schemaManager) This creates the tables on the database.voidcreateTables(DatabaseSession session, SchemaManager schemaManager, boolean build) This creates the tables on the database.voidcreateTables(DatabaseSession session, SchemaManager schemaManager, boolean build, boolean check, boolean createSequenceTables, boolean createSequences) This creates the tables on the database.voiddropConstraints(DatabaseSession session) Drop the table constraints from the database.voiddropConstraints(DatabaseSession session, SchemaManager schemaManager) Drop the table constraints from the database.voiddropConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build) Drop the table constraints from the database.voiddropTables(DatabaseSession session) Drop the tables from the database.voiddropTables(DatabaseSession session, SchemaManager schemaManager) Drop the tables from the database.voiddropTables(DatabaseSession session, SchemaManager schemaManager, boolean build) Drop the tables from the database.voidextendTables(DatabaseSession session, SchemaManager schemaManager) Create or extend the tables on the database.voidextendTables(DatabaseSession session, SchemaManager schemaManager, boolean build) This creates/extends the tables on the database.protected voidextendTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session) getName()Return the name.protected StringgetSequenceTableName(Session session) This returns the Sequence Table's qualified name, without delimiting.Return the tables.voidreplaceTables(DatabaseSession session) Recreate the tables on the database.voidreplaceTables(DatabaseSession session, SchemaManager schemaManager) Recreate the tables on the database.voidreplaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables) Recreate the tables on the database.voidreplaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables, boolean createSequences) Recreate the tables on the database.protected voidreplaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session) protected voidreplaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences) voidsetIgnoreDatabaseException(boolean ignoreDatabaseException) Set flag whether DatabaseException should be ignored.voidSet the name.voidsetTableDefinitions(Vector tableDefinitions) Set the tables.booleanReturn true if DatabaseException is to be ignored.
-
Field Details
-
DEFAULT_IDENTITY_GENERATOR
Default identity generator sequence name. Copy of value from JPA:MetadataProject.DEFAULT_IDENTITY_GENERATOR.- See Also:
-
CHECK_EXISTENCE
public static boolean CHECK_EXISTENCEFlag to disable table existence check before create. -
tableDefinitions
-
name
-
ignoreDatabaseException
protected boolean ignoreDatabaseException
-
-
Constructor Details
-
TableCreator
public TableCreator() -
TableCreator
-
-
Method Details
-
addTableDefinition
Add the table. -
addTableDefinitions
Add a set of tables. -
createConstraints
Create constraints. -
createConstraints
Create constraints. -
createConstraints
Create constraints. -
createConstraints
public void createConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build) Create constraints. -
createTables
This creates the tables on the database. If the table already exists this will fail. -
createTables
This creates the tables on the database. If the table already exists this will fail. -
createTables
This creates the tables on the database. If the table already exists this will fail. -
createTables
public void createTables(DatabaseSession session, SchemaManager schemaManager, boolean build, boolean check, boolean createSequenceTables, boolean createSequences) This creates the tables on the database. If the table already exists this will fail.- Parameters:
session- Active database session.schemaManager- Database schema manipulation manager.build- Whether to build constraints.check- Whether to check for tables existence.createSequenceTables- Whether to create sequence tables.createSequences- Whether to create sequences.
-
dropConstraints
Drop the table constraints from the database. -
dropConstraints
Drop the table constraints from the database. -
dropConstraints
Drop the table constraints from the database. -
dropTables
Drop the tables from the database. -
dropTables
Drop the tables from the database. -
dropTables
Drop the tables from the database.- Parameters:
session- Active database session.schemaManager- Database schema manipulation manager.build- Whether to build constraints.
-
getName
Return the name. -
getTableDefinitions
Return the tables. -
replaceTables
Recreate the tables on the database. This will drop the tables if they exist and recreate them. -
replaceTables
Recreate the tables on the database. This will drop the tables if they exist and recreate them. -
replaceTables
public void replaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables) Recreate the tables on the database. This will drop the tables if they exist and recreate them. -
replaceTables
public void replaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables, boolean createSequences) Recreate the tables on the database. This will drop the tables if they exist and recreate them. -
replaceTablesAndConstraints
protected void replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences) -
replaceTablesAndConstraints
-
buildConstraints
Convert any field constraint to constraint objects. -
setName
Set the name. -
setTableDefinitions
Set the tables. -
shouldIgnoreDatabaseException
public boolean shouldIgnoreDatabaseException()Return true if DatabaseException is to be ignored. -
setIgnoreDatabaseException
public void setIgnoreDatabaseException(boolean ignoreDatabaseException) Set flag whether DatabaseException should be ignored. -
getSequenceTableName
This returns the Sequence Table's qualified name, without delimiting.- Parameters:
session-- Returns:
- the qualified table name
-
extendTables
Create or extend the tables on the database. This will alter existing tables to add missing fields or create the table otherwise. It will also create Sequences tables and objects. -
extendTablesAndConstraints
-
extendTables
This creates/extends the tables on the database.- Parameters:
session- Active database session.schemaManager- Database schema manipulation manager.build- Whether to build constraints.
-