|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 |
---|
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(String fieldName,
Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addField(String fieldName,
Class type,
int fieldSize)
PUBLIC: Add the field to the table. |
void |
addField(String fieldName,
Class type,
int fieldSize,
int fieldSubSize)
PUBLIC: Add the field to the table. |
void |
addField(String fieldName,
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(String name,
String sourceField,
String targetField,
String targetTable)
PUBLIC: Add a foreign key constraint to the table. |
void |
addIdentityField(String fieldName,
Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addIdentityField(String fieldName,
Class type,
int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addPrimaryKeyField(String fieldName,
Class type)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addPrimaryKeyField(String fieldName,
Class type,
int fieldSize)
PUBLIC: Add the field to the table, default sizes are used. |
void |
addUniqueKeyConstraint(String name,
String sourceField)
PUBLIC: Add a unique key constraint to the table. |
void |
addUniqueKeyConstraint(String name,
String[] sourceFields)
PUBLIC: Add a unique key constraint to the table. |
void |
addUniqueKeyConstraint(UniqueKeyConstraint uniqueKey)
PUBLIC: Add a unique key constraint to the table. |
Writer |
buildConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
ForeignKeyConstraint foreignKey,
Writer writer)
INTERNAL: Return the alter table statement to add the constraints. |
Writer |
buildConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
ForeignKeyConstraint foreignKey,
Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. |
Writer |
buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer writer)
INTERNAL: Return the create table statement. |
Writer |
buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer writer)
INTERNAL: Return the drop table statement. |
Writer |
buildIndexCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
String key,
List<String> columnNames,
Writer writer)
INTERNAL: Return the index creation statement. |
Writer |
buildIndexDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
String key,
Writer writer)
INTERNAL: Return the index drop statement. |
Writer |
buildUniqueConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
UniqueKeyConstraint uniqueKey,
Writer writer)
INTERNAL: Return the alter table statement to add the constraints. |
Writer |
buildUniqueConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session,
UniqueKeyConstraint uniqueKey,
Writer writer)
INTERNAL: Return the alter table statement to drop the constraints. |
Object |
clone()
PUBLIC: Performs a deep copy of this table definition. |
void |
createConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session,
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 |
createIndexOnPrimaryKey(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer schemaWriter)
INTERNAL: Write the SQL create index string to create index on primary key if passed a writer, else delegate to a method that executes the string on the database. |
void |
createIndexOnPrimaryKeyOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL create index statement to create index on the primary key. |
void |
createIndicesOnUniqueKeys(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer schemaWriter)
INTERNAL: Write the SQL create index string if passed a writer, else delegate to a method that executes the string on the database. |
void |
createIndicesOnUniqueKeysOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL create index statement to create index on the unique keys. |
void |
createOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the DDL to create this table. |
String |
deletionStringFor(org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
INTERNAL: Return the delete SQL string. |
void |
dropConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session,
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 |
dropFromDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the DDL to drop the table. |
void |
dropIndexOnPrimaryKey(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer schemaWriter)
INTERNAL: Write the SQL drop index string to drop index on PK if passed a writer, else delegate to a method that executes the string on the database. |
void |
dropIndexOnPrimaryKeyOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL drop index string to drop the index on the PK. Exceptions are caught and masked (even if index doesn't exist). |
void |
dropIndicesOnUniqueKeys(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer schemaWriter)
INTERNAL: Execute the SQL drop index string to drop indices. Exceptions are caught and masked so that all the indices are dropped (even if they don't exist). |
void |
dropIndicesOnUniqueKeysOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the SQL drop index string on the database. Exceptions are caught and masked so that all the indices are dropped (even if they don't exist). |
void |
dropObject(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer schemaWriter,
boolean createSQLFiles)
INTERNAL: Execute the DDL to drop the table. |
String |
getCreationPrefix()
INTERNAL: Return the beginning of the sql create statement - the part before the name. |
String |
getCreationSuffix()
INTERNAL: Return the end of the sql create statement - the part after the field list. |
Vector<FieldDefinition> |
getFields()
PUBLIC: |
Vector<ForeignKeyConstraint> |
getForeignKeys()
PUBLIC: Returns the ForeignKeyConstraint list. |
Vector<String> |
getPrimaryKeyFieldNames()
PUBLIC: |
Vector<UniqueKeyConstraint> |
getUniqueKeys()
PUBLIC: |
void |
postCreateObject(org.eclipse.persistence.internal.sessions.AbstractSession session,
Writer createSchemaWriter,
boolean createSQLFiles)
Execute any statements required after the creation of the object |
void |
setCreateSQLFiles(boolean genFlag)
PUBLIC: |
void |
setCreationPrefix(String creationPrefix)
INTERNAL: Set the beginning of the sql create statement - the part before the name. |
void |
setCreationSuffix(String creationSuffix)
INTERNAL: Set the end of the sql create statement - the part after the field list. |
void |
setFields(Vector<FieldDefinition> fields)
PUBLIC: |
void |
setForeignKeys(Vector<ForeignKeyConstraint> foreignKeys)
PUBLIC: Set the ForeignKeyConstraint list. |
void |
setUniqueKeys(Vector<UniqueKeyConstraint> uniqueKeys)
PUBLIC: |
Methods inherited from class org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition |
---|
createObject, getFullName, getName, getQualifier, setName, setQualifier, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TableDefinition()
Method Detail |
---|
public void addField(String fieldName, Class type)
type
- is the Java class type corresponding to the database type.public void addField(String fieldName, Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public void addField(String fieldName, Class type, int fieldSize, int fieldSubSize)
type
- is the Java class type corresponding to the database type.public void addField(String fieldName, String typeName)
typeName
- is the name of the nested type.public void addField(FieldDefinition field)
public void addForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable)
public void addUniqueKeyConstraint(String name, String sourceField)
public void addUniqueKeyConstraint(String name, String[] sourceFields)
public void addForeignKeyConstraint(ForeignKeyConstraint foreignKey)
public void addUniqueKeyConstraint(UniqueKeyConstraint uniqueKey)
public void addIdentityField(String fieldName, Class type)
type
- is the Java class type corresponding to the database type.public void addIdentityField(String fieldName, Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public void addPrimaryKeyField(String fieldName, Class type)
type
- is the Java class type corresponding to the database type.public void addPrimaryKeyField(String fieldName, Class type, int fieldSize)
type
- is the Java class type corresponding to the database type.public Writer buildConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignKeyConstraint foreignKey, Writer writer) throws ValidationException
ValidationException
public Writer buildConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignKeyConstraint foreignKey, Writer writer) throws ValidationException
ValidationException
public Writer buildUniqueConstraintCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, UniqueKeyConstraint uniqueKey, Writer writer) throws ValidationException
ValidationException
public Writer buildUniqueConstraintDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, UniqueKeyConstraint uniqueKey, Writer writer) throws ValidationException
ValidationException
public Writer buildIndexCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, String key, List<String> columnNames, Writer writer) throws ValidationException
ValidationException
public Writer buildIndexDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, String key, Writer writer) throws ValidationException
ValidationException
public String getCreationPrefix()
public void setCreationPrefix(String creationPrefix)
public String getCreationSuffix()
public void setCreationSuffix(String creationSuffix)
public Writer buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer writer) throws ValidationException
buildCreationWriter
in class DatabaseObjectDefinition
ValidationException
public Writer buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer writer) throws ValidationException
buildDeletionWriter
in class DatabaseObjectDefinition
ValidationException
public Object clone()
clone
in class DatabaseObjectDefinition
public void createConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter) throws EclipseLinkException
EclipseLinkException
public void createConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void createIndexOnPrimaryKey(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter)
ValidationException
- wraps any IOException from the writercreateIndexOnPrimaryKeyOnDatabase(AbstractSession)
public void createIndicesOnUniqueKeys(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter) throws EclipseLinkException
ValidationException
- wraps any IOException from the writer
EclipseLinkException
createIndicesOnUniqueKeysOnDatabase(AbstractSession)
public void createIndexOnPrimaryKeyOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
public void createIndicesOnUniqueKeysOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
public void createOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
createOnDatabase
in class DatabaseObjectDefinition
EclipseLinkException
public String deletionStringFor(org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
public void dropConstraints(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter) throws EclipseLinkException
EclipseLinkException
public void dropConstraintsOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void dropFromDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
dropFromDatabase
in class DatabaseObjectDefinition
EclipseLinkException
public void dropIndexOnPrimaryKey(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter) throws EclipseLinkException
ValidationException
- wraps any IOException from the writer
EclipseLinkException
dropIndexOnPrimaryKeyOnDatabase(AbstractSession)
public void dropIndicesOnUniqueKeys(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter) throws EclipseLinkException
EclipseLinkException
public void dropIndexOnPrimaryKeyOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void dropIndicesOnUniqueKeysOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
EclipseLinkException
public void dropObject(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer schemaWriter, boolean createSQLFiles) throws EclipseLinkException
dropObject
in class DatabaseObjectDefinition
EclipseLinkException
public Vector<FieldDefinition> getFields()
public Vector<ForeignKeyConstraint> getForeignKeys()
public Vector<UniqueKeyConstraint> getUniqueKeys()
public Vector<String> getPrimaryKeyFieldNames()
public void postCreateObject(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer createSchemaWriter, boolean createSQLFiles)
postCreateObject
in class DatabaseObjectDefinition
session
- createSchemaWriter
- public void setFields(Vector<FieldDefinition> fields)
public void setForeignKeys(Vector<ForeignKeyConstraint> foreignKeys)
public void setUniqueKeys(Vector<UniqueKeyConstraint> uniqueKeys)
public void setCreateSQLFiles(boolean genFlag)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |