|
EclipseLink 2.3.2, build 'v20111125-r10461' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition org.eclipse.persistence.tools.schemaframework.TableDefinition
public class TableDefinition
Purpose: Allow a generic way of creating tables on the different platforms.
Field Summary | |
---|---|
protected java.lang.String |
creationPrefix
|
protected java.lang.String |
creationSuffix
|
protected java.util.List<FieldDefinition> |
fields
|
protected java.util.Map<java.lang.String,ForeignKeyConstraint> |
foreignKeyMap
|
protected java.util.List<IndexDefinition> |
indexes
|
protected java.util.List<UniqueKeyConstraint> |
uniqueKeys
|
Fields inherited from class org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition |
---|
name, qualifier |
Constructor Summary | |
---|---|
TableDefinition()
|
Method Summary | |
---|---|
void |
addField(FieldDefinition field)
PUBLIC: Add the field to the table. |
void |
addField(java.lang.String fieldName,
java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addField(java.lang.String fieldName,
java.lang.Class type,
int fieldSize)
PUBLIC: Add the field to the table. |
void |
addField(java.lang.String fieldName,
java.lang.Class type,
int fieldSize,
int fieldSubSize)
PUBLIC: Add the field to the table. |
void |
addField(java.lang.String fieldName,
java.lang.String typeName)
PUBLIC: Add the field to the type to a nested type. |
void |
addForeignKeyConstraint(ForeignKeyConstraint foreignKey)
PUBLIC: Add a foreign key constraint to the table. |
void |
addForeignKeyConstraint(java.lang.String name,
java.lang.String sourceField,
java.lang.String targetField,
java.lang.String targetTable)
PUBLIC: Add a foreign key constraint to the table. |
void |
addIdentityField(java.lang.String fieldName,
java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addIdentityField(java.lang.String fieldName,
java.lang.Class type,
int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addIndex(IndexDefinition index)
PUBLIC: Add an index to the table. |
void |
addPrimaryKeyField(java.lang.String fieldName,
java.lang.Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addPrimaryKeyField(java.lang.String fieldName,
java.lang.Class type,
int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addUniqueKeyConstraint(java.lang.String name,
java.lang.String sourceField)
PUBLIC: Add a unique key constraint to the table. |
void |
addUniqueKeyConstraint(java.lang.String name,
java.lang.String[] sourceFields)
PUBLIC: Add a unique key constraint to the table. |
void |
addUniqueKeyConstraint(UniqueKeyConstraint uniqueKey)
PUBLIC: Add a unique key constraint to the table. |
java.io.Writer |
buildConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
ForeignKeyConstraint foreignKey,
java.io.Writer writer)
INTERNAL: Return the alter table statement to add the constraints. |
java.io.Writer |
buildConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
ForeignKeyConstraint foreignKey,
java.io.Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. |
java.io.Writer |
buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
INTERNAL: Return the create table statement. |
java.io.Writer |
buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
INTERNAL: Return the drop table statement. |
protected void |
buildFieldTypes(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Build the foreign key constraints. |
protected ForeignKeyConstraint |
buildForeignKeyConstraint(FieldDefinition field,
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
Build a foreign key constraint using FieldDefinition.getForeignKeyFieldName(). |
protected ForeignKeyConstraint |
buildForeignKeyConstraint(java.util.List<java.lang.String> fkFieldNames,
java.util.List<java.lang.String> pkFieldNames,
TableDefinition targetTable,
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
Build a foreign key constraint. |
protected java.lang.String |
buildForeignKeyConstraintName(java.lang.String tableName,
java.lang.String fieldName,
int maximumNameLength,
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
Return foreign key constraint name built from the table and field name with the specified maximum length. |
IndexDefinition |
buildIndex(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.lang.String key,
java.util.List<java.lang.String> columnNames,
boolean isUniqueSetOnField)
INTERNAL: Return the index creation statement. |
java.io.Writer |
buildIndexDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.lang.String key,
java.io.Writer writer,
boolean isUniqueSetOnField)
INTERNAL: Return the index drop statement. |
protected java.lang.String |
buildIndexName(java.lang.String tableName,
java.lang.String key,
java.lang.String indexPrefix,
int maximumNameLength,
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
Return key constraint name built from the table and key name with the specified maximum length and index prefix. |
java.io.Writer |
buildUniqueConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
UniqueKeyConstraint uniqueKey,
java.io.Writer writer)
INTERNAL: Return the alter table statement to add the constraints. |
java.io.Writer |
buildUniqueConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
UniqueKeyConstraint uniqueKey,
java.io.Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. |
protected UniqueKeyConstraint |
buildUniqueKeyConstraint(java.lang.String name,
java.util.List<java.lang.String> fieldNames,
int serialNumber,
org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
|
protected java.lang.String |
buildUniqueKeyConstraintName(java.lang.String tableName,
int serialNumber,
int maximumNameLength)
Return unique key constraint name built from the table name and sequence number with the specified maximum length. |
java.io.Writer |
buildVPDCreationFunctionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
INTERNAL: |
java.io.Writer |
buildVPDCreationPolicyWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
INTERNAL: |
java.io.Writer |
buildVPDDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
INTERNAL: |
java.lang.Object |
clone()
PUBLIC: Performs a deep copy of this table definition. |
void |
createConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer schemaWriter)
INTERNAL: Execute the SQL alter table constraint creation string. |
void |
createConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL alter table constraint creation string. |
void |
createIndexes(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.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. |
java.lang.String |
deletionStringFor(org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
INTERNAL: Return the delete SQL string. |
void |
dropConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer schemaWriter)
INTERNAL: Execute the SQL alter table constraint creation string. |
void |
dropConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL alter table constraint creation string. |
void |
dropIndexes(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.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. |
java.lang.String |
getCreationPrefix()
INTERNAL: Return the beginning of the sql create statement - the part before the name. |
java.lang.String |
getCreationSuffix()
INTERNAL: Return the end of the sql create statement - the part after the field list. |
java.util.List<FieldDefinition> |
getFields()
PUBLIC: |
java.util.Map<java.lang.String,ForeignKeyConstraint> |
getForeignKeyMap()
INTERNAL: |
java.util.Collection<ForeignKeyConstraint> |
getForeignKeys()
PUBLIC: Returns the ForeignKeyConstraint list. |
java.util.List<IndexDefinition> |
getIndexes()
PUBLIC: |
java.util.List<java.lang.String> |
getPrimaryKeyFieldNames()
PUBLIC: |
java.util.List<UniqueKeyConstraint> |
getUniqueKeys()
PUBLIC: |
void |
postCreateObject(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer createSchemaWriter,
boolean createSQLFiles)
Execute any statements required after the creation of the object |
void |
preDropObject(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer dropSchemaWriter,
boolean createSQLFiles)
Execute any statements required before the deletion of the object |
void |
setCreateSQLFiles(boolean genFlag)
PUBLIC: |
void |
setCreateVPDCalls(boolean createVPDCalls,
java.lang.String tenantFieldName)
PUBLIC: |
void |
setCreationPrefix(java.lang.String creationPrefix)
INTERNAL: Set the beginning of the sql create statement - the part before the name. |
void |
setCreationSuffix(java.lang.String creationSuffix)
INTERNAL: Set the end of the sql create statement - the part after the field list. |
void |
setFields(java.util.List<FieldDefinition> fields)
PUBLIC: |
void |
setForeignKeyMap(java.util.Map<java.lang.String,ForeignKeyConstraint> foreignKeyMap)
INTERNAL: |
void |
setForeignKeys(java.util.List<ForeignKeyConstraint> foreignKeys)
PUBLIC: Set the ForeignKeyConstraint list. |
void |
setIndexes(java.util.List<IndexDefinition> indexes)
PUBLIC: |
void |
setUniqueKeys(java.util.List<UniqueKeyConstraint> uniqueKeys)
PUBLIC: |
boolean |
shouldCreateVPDCalls(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Subclasses who care should override this method. |
void |
writeLineSeperator(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.io.Writer writer)
|
Methods inherited from class org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition |
---|
createObject, createOnDatabase, dropFromDatabase, dropObject, getFullName, getName, getQualifier, setName, setQualifier, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.List<FieldDefinition> fields
protected java.util.Map<java.lang.String,ForeignKeyConstraint> foreignKeyMap
protected java.util.List<UniqueKeyConstraint> uniqueKeys
protected java.util.List<IndexDefinition> indexes
protected java.lang.String creationPrefix
protected java.lang.String creationSuffix
Constructor Detail |
---|
public TableDefinition()
Method Detail |
---|
public void addField(java.lang.String fieldName, java.lang.Class type)
type
- is the Java class type corresponding to the database type.public void addField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public void addField(java.lang.String fieldName, java.lang.Class type, int fieldSize, int fieldSubSize)
type
- is the Java class type corresponding to the database type.public void addField(java.lang.String fieldName, java.lang.String typeName)
typeName
- is the name of the nested type.public void addField(FieldDefinition field)
public void addForeignKeyConstraint(java.lang.String name, java.lang.String sourceField, java.lang.String targetField, java.lang.String targetTable)
public void addUniqueKeyConstraint(java.lang.String name, java.lang.String sourceField)
public void addUniqueKeyConstraint(java.lang.String name, java.lang.String[] sourceFields)
public void addForeignKeyConstraint(ForeignKeyConstraint foreignKey)
public void addUniqueKeyConstraint(UniqueKeyConstraint uniqueKey)
public void addIndex(IndexDefinition index)
public void addIdentityField(java.lang.String fieldName, java.lang.Class type)
type
- is the Java class type corresponding to the database type.public void addIdentityField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public void addPrimaryKeyField(java.lang.String fieldName, java.lang.Class type)
type
- is the Java class type corresponding to the database type.public void addPrimaryKeyField(java.lang.String fieldName, java.lang.Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public java.io.Writer buildConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignKeyConstraint foreignKey, java.io.Writer writer) throws ValidationException
ValidationException
public java.io.Writer buildConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignKeyConstraint foreignKey, java.io.Writer writer) throws ValidationException
ValidationException
public java.io.Writer buildUniqueConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, UniqueKeyConstraint uniqueKey, java.io.Writer writer) throws ValidationException
ValidationException
public java.io.Writer buildUniqueConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, UniqueKeyConstraint uniqueKey, java.io.Writer writer) throws ValidationException
ValidationException
public IndexDefinition buildIndex(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String key, java.util.List<java.lang.String> columnNames, boolean isUniqueSetOnField)
public java.io.Writer buildIndexDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String key, java.io.Writer writer, boolean isUniqueSetOnField)
public java.lang.String getCreationPrefix()
public void setCreationPrefix(java.lang.String creationPrefix)
public java.lang.String getCreationSuffix()
public void setCreationSuffix(java.lang.String creationSuffix)
public java.io.Writer buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer) throws ValidationException
buildCreationWriter
in class DatabaseObjectDefinition
ValidationException
public java.io.Writer buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer) throws ValidationException
buildDeletionWriter
in class DatabaseObjectDefinition
ValidationException
public java.io.Writer buildVPDCreationPolicyWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
buildVPDCreationPolicyWriter
in class DatabaseObjectDefinition
public java.io.Writer buildVPDCreationFunctionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
buildVPDCreationFunctionWriter
in class DatabaseObjectDefinition
public java.io.Writer buildVPDDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
buildVPDDeletionWriter
in class DatabaseObjectDefinition
protected void buildFieldTypes(org.eclipse.persistence.internal.sessions.AbstractSession session)
protected ForeignKeyConstraint buildForeignKeyConstraint(FieldDefinition field, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
protected ForeignKeyConstraint buildForeignKeyConstraint(java.util.List<java.lang.String> fkFieldNames, java.util.List<java.lang.String> pkFieldNames, TableDefinition targetTable, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
protected java.lang.String buildForeignKeyConstraintName(java.lang.String tableName, java.lang.String fieldName, int maximumNameLength, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
protected UniqueKeyConstraint buildUniqueKeyConstraint(java.lang.String name, java.util.List<java.lang.String> fieldNames, int serialNumber, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
protected java.lang.String buildUniqueKeyConstraintName(java.lang.String tableName, int serialNumber, int maximumNameLength)
protected java.lang.String buildIndexName(java.lang.String tableName, java.lang.String key, java.lang.String indexPrefix, int maximumNameLength, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
1. Drop the prefix. 2. Drop the underscore characters if any. 3. Drop the vowels from the table and key name. 4. Truncate the table name to zero length if necessary.
public java.lang.Object clone()
clone
in class DatabaseObjectDefinition
public void createConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer schemaWriter) throws EclipseLinkException
EclipseLinkException
public void createConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void createIndexes(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
ValidationException
- wraps any IOException from the writerpublic void writeLineSeperator(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
public java.lang.String deletionStringFor(org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
public void dropConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer schemaWriter) throws EclipseLinkException
EclipseLinkException
public void dropConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void dropIndexes(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
ValidationException
- wraps any IOException from the writerpublic java.util.Map<java.lang.String,ForeignKeyConstraint> getForeignKeyMap()
public void setForeignKeyMap(java.util.Map<java.lang.String,ForeignKeyConstraint> foreignKeyMap)
public java.util.List<FieldDefinition> getFields()
public java.util.Collection<ForeignKeyConstraint> getForeignKeys()
public java.util.List<UniqueKeyConstraint> getUniqueKeys()
public void setIndexes(java.util.List<IndexDefinition> indexes)
public void setCreateVPDCalls(boolean createVPDCalls, java.lang.String tenantFieldName)
public java.util.List<IndexDefinition> getIndexes()
public java.util.List<java.lang.String> getPrimaryKeyFieldNames()
public void postCreateObject(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer createSchemaWriter, boolean createSQLFiles)
postCreateObject
in class DatabaseObjectDefinition
session
- createSchemaWriter
- public void preDropObject(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer dropSchemaWriter, boolean createSQLFiles)
preDropObject
in class DatabaseObjectDefinition
session
- dropSchemaWriter
- public void setFields(java.util.List<FieldDefinition> fields)
public void setForeignKeys(java.util.List<ForeignKeyConstraint> foreignKeys)
public void setUniqueKeys(java.util.List<UniqueKeyConstraint> uniqueKeys)
public boolean shouldCreateVPDCalls(org.eclipse.persistence.internal.sessions.AbstractSession session)
shouldCreateVPDCalls
in class DatabaseObjectDefinition
public void setCreateSQLFiles(boolean genFlag)
|
EclipseLink 2.3.2, build 'v20111125-r10461' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |