Top Description Fields Constructors Methods
org.eclipse.persistence.tools.schemaframework

public Class TableCreator

extends Object
Class Inheritance
Imports
java.sql.SQLException, java.util.ArrayList, .Collection, .HashMap, .HashSet, .List, .Map, .Set, org.eclipse.persistence.exceptions.DatabaseException, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.platform.database.DatabasePlatform, org.eclipse.persistence.sequencing.Sequence, .TableSequence, org.eclipse.persistence.sessions.DatabaseRecord, .DatabaseSession, .Session

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
Since
TopLink 2.0

Field Summary

Modifier and TypeField and Description
public static boolean
CHECK_EXISTENCE

Flag to disable table existence check before create.

public static final String
DEFAULT_IDENTITY_GENERATOR

Default identity generator sequence name.

protected boolean
protected String
protected List<TableDefinition>

Constructor Summary

AccessConstructor and Description
public
public
TableCreator(List<TableDefinition> tableDefinitions)

Method Summary

Modifier and TypeMethod and Description
public void
addTableDefinition(TableDefinition tableDefinition)

Add the table.

public void
addTableDefinitions(Collection<TableDefinition> tableDefs)

Add a set of tables.

protected void
buildConstraints(SchemaManager schemaManager, boolean build)

Convert any field constraint to constraint objects.

public void
createConstraints(DatabaseSession session)

Create constraints.

public void
createConstraints(DatabaseSession session, SchemaManager schemaManager)

Create constraints.

public void
createConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build)

Create constraints.

public void
createConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build)

Create constraints.

public void
createTables(DatabaseSession session)

This creates the tables on the database.

public void
createTables(DatabaseSession session, SchemaManager schemaManager)

This creates the tables on the database.

public void
createTables(DatabaseSession session, SchemaManager schemaManager, boolean build)

This creates the tables on the database.

public void
createTables(final DatabaseSession
Active database session.
session
,
final SchemaManager
Database schema manipulation manager.
schemaManager
,
final boolean
Whether to build constraints.
build
,
final boolean
Whether to check for tables existence.
check
,
final boolean
Whether to create sequence tables.
createSequenceTables
,
final boolean
Whether to create sequences.
createSequences
)

This creates the tables on the database.

public void
dropConstraints(DatabaseSession session)

Drop the table constraints from the database.

public void
dropConstraints(DatabaseSession session, SchemaManager schemaManager)

Drop the table constraints from the database.

public void
dropConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build)

Drop the table constraints from the database.

public void
dropTables(DatabaseSession session)

Drop the tables from the database.

public void
dropTables(DatabaseSession session, SchemaManager schemaManager)

Drop the tables from the database.

public void
dropTables(final DatabaseSession
Active database session.
session
,
final SchemaManager
Database schema manipulation manager.
schemaManager
,
final boolean
Whether to build constraints.
build
)

Drop the tables from the database.

public void
extendTables(DatabaseSession session, SchemaManager schemaManager)

Create or extend the tables on the database.

public void
extendTables(final DatabaseSession
Active database session.
session
,
final SchemaManager
Database schema manipulation manager.
schemaManager
,
final boolean
Whether to build constraints.
build
)

This creates/extends the tables on the database.

protected void
public String
getName()

Return the name.

protected String

Returns:

the qualified table name
getSequenceTableName
(Session session)

This returns the Sequence Table's qualified name, without delimiting.

public List<TableDefinition>
getTableDefinitions()

Return the tables.

public void
replaceTables(DatabaseSession session)

Recreate the tables on the database.

public void
replaceTables(DatabaseSession session, SchemaManager schemaManager)

Recreate the tables on the database.

public void
replaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables)

Recreate the tables on the database.

public void
replaceTables(DatabaseSession session, SchemaManager schemaManager, boolean createSequenceTables, boolean createSequences)

Recreate the tables on the database.

protected void
replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences)

protected void
public void
setIgnoreDatabaseException(boolean ignoreDatabaseException)

Set flag whether DatabaseException should be ignored.

public void
setName(String name)

Set the name.

public void
setTableDefinitions(List<TableDefinition> tableDefinitions)

Set the tables.

public boolean
shouldIgnoreDatabaseException()

Return true if DatabaseException is to be ignored.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHECK_EXISTENCEback to summary
public static boolean CHECK_EXISTENCE

Flag to disable table existence check before create.

DEFAULT_IDENTITY_GENERATORback to summary
public static final String DEFAULT_IDENTITY_GENERATOR

Default identity generator sequence name. Copy of value from JPA: MetadataProject.DEFAULT_IDENTITY_GENERATOR.

ignoreDatabaseExceptionback to summary
protected boolean ignoreDatabaseException
nameback to summary
protected String name
tableDefinitionsback to summary
protected List<TableDefinition> tableDefinitions

Constructor Detail

TableCreatorback to summary
public TableCreator()
TableCreatorback to summary
public TableCreator(List<TableDefinition> tableDefinitions)

Method Detail

addTableDefinitionback to summary
public void addTableDefinition(TableDefinition tableDefinition)

Add the table.

addTableDefinitionsback to summary
public void addTableDefinitions(Collection<TableDefinition> tableDefs)

Add a set of tables.

buildConstraintsback to summary
protected void buildConstraints(SchemaManager schemaManager, boolean build)

Convert any field constraint to constraint objects.

createConstraintsback to summary
public void createConstraints(DatabaseSession session)

Create constraints.

createConstraintsback to summary
public void createConstraints(DatabaseSession session, SchemaManager schemaManager)

Create constraints.

createConstraintsback to summary
public void createConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build)

Create constraints.

createConstraintsback to summary
public void createConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build)

Create constraints.

createTablesback to summary
public void createTables(DatabaseSession session)

This creates the tables on the database. If the table already exists this will fail.

createTablesback to summary
public void createTables(DatabaseSession session, SchemaManager schemaManager)

This creates the tables on the database. If the table already exists this will fail.

createTablesback to summary
public void createTables(DatabaseSession session, SchemaManager schemaManager, boolean build)

This creates the tables on the database. If the table already exists this will fail.

createTablesback to summary
public void createTables(final DatabaseSession session, final SchemaManager schemaManager, final boolean build, final boolean check, final boolean createSequenceTables, final boolean createSequences)

This creates the tables on the database. If the table already exists this will fail.

Parameters
session:DatabaseSession

Active database session.

schemaManager:SchemaManager

Database schema manipulation manager.

build:boolean

Whether to build constraints.

check:boolean

Whether to check for tables existence.

createSequenceTables:boolean

Whether to create sequence tables.

createSequences:boolean

Whether to create sequences.

dropConstraintsback to summary
public void dropConstraints(DatabaseSession session)

Drop the table constraints from the database.

dropConstraintsback to summary
public void dropConstraints(DatabaseSession session, SchemaManager schemaManager)

Drop the table constraints from the database.

dropConstraintsback to summary
public void dropConstraints(DatabaseSession session, SchemaManager schemaManager, boolean build)

Drop the table constraints from the database.

dropTablesback to summary
public void dropTables(DatabaseSession session)

Drop the tables from the database.

dropTablesback to summary
public void dropTables(DatabaseSession session, SchemaManager schemaManager)

Drop the tables from the database.

dropTablesback to summary
public void dropTables(final DatabaseSession session, final SchemaManager schemaManager, final boolean build)

Drop the tables from the database.

Parameters
session:DatabaseSession

Active database session.

schemaManager:SchemaManager

Database schema manipulation manager.

build:boolean

Whether to build constraints.

extendTablesback to summary
public void extendTables(DatabaseSession session, SchemaManager schemaManager)

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.

extendTablesback to summary
public void extendTables(final DatabaseSession session, final SchemaManager schemaManager, final boolean build)

This creates/extends the tables on the database.

Parameters
session:DatabaseSession

Active database session.

schemaManager:SchemaManager

Database schema manipulation manager.

build:boolean

Whether to build constraints.

extendTablesAndConstraintsback to summary
protected void extendTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session)
getNameback to summary
public String getName()

Return the name.

getSequenceTableNameback to summary
protected String getSequenceTableName(Session session)

This returns the Sequence Table's qualified name, without delimiting.

Returns:String

the qualified table name

getTableDefinitionsback to summary
public List<TableDefinition> getTableDefinitions()

Return the tables.

replaceTablesback to summary
public void replaceTables(DatabaseSession session)

Recreate the tables on the database. This will drop the tables if they exist and recreate them.

replaceTablesback to summary
public void replaceTables(DatabaseSession session, SchemaManager schemaManager)

Recreate the tables on the database. This will drop the tables if they exist and recreate them.

replaceTablesback to summary
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.

replaceTablesback to summary
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.

replaceTablesAndConstraintsback to summary
protected void replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences)
replaceTablesAndConstraintsback to summary
protected void replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session)
setIgnoreDatabaseExceptionback to summary
public void setIgnoreDatabaseException(boolean ignoreDatabaseException)

Set flag whether DatabaseException should be ignored.

setNameback to summary
public void setName(String name)

Set the name.

setTableDefinitionsback to summary
public void setTableDefinitions(List<TableDefinition> tableDefinitions)

Set the tables.

shouldIgnoreDatabaseExceptionback to summary
public boolean shouldIgnoreDatabaseException()

Return true if DatabaseException is to be ignored.