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

public Class TableDefinition

extends DatabaseObjectDefinition
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.tools.schemaframework.TypeTableDefinition
Imports
java.io.IOException, .StringWriter, .Writer, java.util.ArrayList, .Collection, .HashMap, .Iterator, .List, .Map, .Set, .Vector, org.eclipse.persistence.exceptions.DatabaseException, .EclipseLinkException, .ValidationException, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor, .DatabasePlatform, org.eclipse.persistence.internal.helper.DatabaseField, .DatabaseTable, .Helper, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.queries.SQLCall

Purpose: Allow a generic way of creating tables on the different platforms.

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
protected String
protected String
protected List<FieldDefinition>
protected Map<String, ForeignKeyConstraint>
protected boolean
protected List<IndexDefinition>
protected DatabaseTable
private String
protected List<UniqueKeyConstraint>
Inherited from org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition:
namequalifier

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
)

PUBLIC: Add the field to the table, default sizes are used.

public void
addField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
,
int fieldSize)

PUBLIC: Add the field to the table.

public void
addField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
,
int fieldSize, int fieldSubSize)

PUBLIC: Add the field to the table.

public void
addField(String fieldName, String
is the name of the nested type.
typeName
)

PUBLIC: Add the field to the type to a nested type.

public void
addField(FieldDefinition field)

PUBLIC: Add the field to the table.

public void
addFieldOnDatabase(final AbstractSession session, FieldDefinition field)

INTERNAL: Execute the SQL alter table to add the field to the table.

public void
addForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable)

PUBLIC: Add a foreign key constraint to the table.

public void
addForeignKeyConstraint(ForeignKeyConstraint foreignKey)

PUBLIC: Add a foreign key constraint to the table.

public void
addIdentityField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
)

PUBLIC: Add the field to the table, default sizes are used.

public void
addIdentityField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
,
int fieldSize)

PUBLIC: Add the field to the table, default sizes are used.

public void
addIndex(IndexDefinition index)

PUBLIC: Add an index to the table.

public void
addPrimaryKeyField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
)

PUBLIC: Add the field to the table, default sizes are used.

public void
addPrimaryKeyField(String fieldName, Class<?>
is the Java class type corresponding to the database type.
type
,
int fieldSize)

PUBLIC: Add the field to the table, default sizes are used.

public void
addUniqueKeyConstraint(String name, String sourceField)

PUBLIC: Add a unique key constraint to the table.

public void
addUniqueKeyConstraint(String name, String[] sourceFields)

PUBLIC: Add a unique key constraint to the table.

public void
addUniqueKeyConstraint(UniqueKeyConstraint uniqueKey)

PUBLIC: Add a unique key constraint to the table.

public Writer
buildAddFieldWriter(AbstractSession session, FieldDefinition field, Writer writer)

INTERNAL: Return the alter table statement to add a field to the table.

public Writer
buildConstraintCreationWriter(AbstractSession session, ForeignKeyConstraint foreignKey, Writer writer)

INTERNAL: Return the alter table statement to add the constraints.

public Writer
buildConstraintDeletionWriter(AbstractSession session, ForeignKeyConstraint foreignKey, Writer writer)

INTERNAL: Return the alter table statement to drop the constraints.

public Writer
protected Writer
buildDatabaseSchemaCreationWriter(AbstractSession session, Writer writer, Set<String> createdDatabaseSchemas)

INTERNAL: Build the create schema DDL.

protected Writer
buildDatabaseSchemaDeletionWriter(AbstractSession session, Writer writer)

INTERNAL: Build the drop schema DDL.

public Writer
protected void
buildFieldTypes(AbstractSession session)

INTERNAL: Build the foreign key constraints.

protected ForeignKeyConstraint
buildForeignKeyConstraint(FieldDefinition field, DatabasePlatform platform)

Build a foreign key constraint using FieldDefinition.getForeignKeyFieldName().

protected ForeignKeyConstraint
buildForeignKeyConstraint(List<String> fkFieldNames, List<String> pkFieldNames, TableDefinition targetTable, DatabasePlatform platform)

Build a foreign key constraint.

protected String
buildForeignKeyConstraintName(String tableName, String fieldName, int maximumNameLength, DatabasePlatform platform)

Return foreign key constraint name built from the table and field name with the specified maximum length.

public IndexDefinition
buildIndex(AbstractSession session, String key, List<String> columnNames, boolean isUniqueSetOnField)

INTERNAL: Return the index creation statement.

public Writer
buildIndexDeletionWriter(AbstractSession session, String key, Writer writer, boolean isUniqueSetOnField)

INTERNAL: Return the index drop statement.

protected String
buildIndexName(String tableName, String key, String indexPrefix, int maximumNameLength, DatabasePlatform platform)

Return key constraint name built from the table and key name with the specified maximum length and index prefix.

public Writer
buildUniqueConstraintCreationWriter(AbstractSession session, UniqueKeyConstraint uniqueKey, Writer writer)

INTERNAL: Return the alter table statement to add the constraints.

public Writer
buildUniqueConstraintDeletionWriter(AbstractSession session, UniqueKeyConstraint uniqueKey, Writer writer)

INTERNAL: Return the alter table statement to drop the constraints.

protected UniqueKeyConstraint
buildUniqueKeyConstraint(String name, List<String> fieldNames, int serialNumber, DatabasePlatform platform)

protected String
buildUniqueKeyConstraintName(String tableName, int serialNumber, int maximumNameLength)

Return unique key constraint name built from the table name and sequence number with the specified maximum length.

public Writer
public Writer
public Writer
public Object
clone()

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.clone.

PUBLIC: Performs a deep copy of this table definition.
public void
createConstraints(AbstractSession session, Writer schemaWriter)

INTERNAL: Execute the SQL alter table constraint creation string.

public void
createConstraintsOnDatabase(AbstractSession session)

INTERNAL: Execute the SQL alter table constraint creation string.

public void
createDatabaseSchema(AbstractSession session, Writer writer, Set<String> createdDatabaseSchemas)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.createDatabaseSchema.

INTERNAL: Execute the DDL to create the database schema for this object.
public void
createDatabaseSchemaOnDatabase(AbstractSession session, Set<String> createdDatabaseSchemas)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.createDatabaseSchemaOnDatabase.

INTERNAL: Execute the DDL to create the database schema for this object.
pack-priv void
createForeignConstraints(final AbstractSession session, final Writer schemaWriter)

pack-priv void
public void
createIndexes(AbstractSession session, Writer writer)

INTERNAL: Write the SQL create index string to create index if passed a writer, else delegate to a method that executes the string on the database.

pack-priv void
createUniqueConstraints(final AbstractSession session, final Writer schemaWriter)

pack-priv void
public String
deletionStringFor(DatabaseAccessor accessor)

INTERNAL: Return the delete SQL string.

public void
dropConstraints(AbstractSession session, Writer schemaWriter)

INTERNAL: Execute the SQL alter table constraint creation string.

public void
dropConstraintsOnDatabase(AbstractSession session)

INTERNAL: Execute the SQL alter table constraint creation string.

public void
dropDatabaseSchema(AbstractSession session, Writer writer)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.dropDatabaseSchema.

INTERNAL: Execute the DDL to drop the database schema for this object.
public void
private void
public void
dropIndexes(AbstractSession session, Writer writer)

INTERNAL: Write the SQL drop index string to drop indexes if passed a writer, else delegate to a method that executes the string on the database.

private void
public String
getCreationPrefix()

INTERNAL: Return the beginning of the sql create statement - the part before the name.

public String
getCreationSuffix()

INTERNAL: Return the end of the sql create statement - the part after the field list.

public String
public FieldDefinition
getField(String fieldName)

PUBLIC: Return the field the corresponds to the name.

public List<FieldDefinition>
getFields()

PUBLIC:

public Map<String, ForeignKeyConstraint>
getForeignKeyMap()

INTERNAL:

public Collection<ForeignKeyConstraint>
getForeignKeys()

PUBLIC: Returns the ForeignKeyConstraint list.

public List<IndexDefinition>
getIndexes()

PUBLIC:

public List<String>
public DatabaseTable
public List<UniqueKeyConstraint>
getUniqueKeys()

PUBLIC:

public void
postCreateObject(AbstractSession session, Writer createSchemaWriter, boolean createSQLFiles)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.postCreateObject.

Execute any statements required after the creation of the object
public void
preDropObject(AbstractSession session, Writer dropSchemaWriter, boolean createSQLFiles)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.preDropObject.

Execute any statements required before the deletion of the object
public void
setCreateSQLFiles(boolean genFlag)

PUBLIC:

public void
setCreateVPDCalls(boolean createVPDCalls, String tenantFieldName)

PUBLIC:

public void
setCreationPrefix(String creationPrefix)

INTERNAL: Set the beginning of the sql create statement - the part before the name.

public void
setCreationSuffix(String creationSuffix)

INTERNAL: Set the end of the sql create statement - the part after the field list.

public void
setFields(List<FieldDefinition> fields)

PUBLIC:

public void
setForeignKeyMap(Map<String, ForeignKeyConstraint> foreignKeyMap)

INTERNAL:

public void
setForeignKeys(List<ForeignKeyConstraint> foreignKeys)

PUBLIC: Set the ForeignKeyConstraint list.

public void
setIndexes(List<IndexDefinition> indexes)

PUBLIC:

public void
public void
public void
setUserDefinedForeignKeyConstraints(Map<String, ForeignKeyConstraint> foreignKeyConstraints)

PUBLIC: Set the foreign key constraints for this table.

public boolean
shouldCreateDatabaseSchema(Set<String> createdDatabaseSchemas)

Overrides org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.shouldCreateDatabaseSchema.

If this table has a schema (and catalog specified) make sure it is created.
public boolean
public void
Inherited from org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition:
createObjectcreateOnDatabasedropFromDatabasedropObjectgetFieldTypeDefinitiongetFieldTypeDefinitiongetFullNamegetNamegetQualifierhasDatabaseSchemasetNamesetQualifiertoString