Module org.eclipse.persistence.core
Class DatabaseObjectDefinition
java.lang.Object
org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
IndexDefinition
,NestedTableDefinition
,PackageDefinition
,SequenceDefinition
,StoredProcedureDefinition
,TableDefinition
,TypeDefinition
,VarrayDefinition
,ViewDefinition
Purpose: Define a database object for the purpose of creation and deletion. A database object is an entity such as a table, view, proc, sequence...
Responsibilities:
- Be able to create and drop the object from the database.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Writer
buildCreationWriter
(AbstractSession session, Writer writer) INTERNAL: Returns the writer used for creation of this object.abstract Writer
buildDeletionWriter
(AbstractSession session, Writer writer) INTERNAL: Returns the writer used for deletion of this object.buildVPDCreationFunctionWriter
(AbstractSession session, Writer writer) INTERNAL: Sub classes should override.buildVPDCreationPolicyWriter
(AbstractSession session, Writer writer) INTERNAL: Sub classes should override.buildVPDDeletionWriter
(AbstractSession session, Writer writer) INTERNAL: Sub classes should override.clone()
PUBLIC:void
createDatabaseSchema
(AbstractSession session, Writer writer, Set<String> createdDatabaseSchemas) INTERNAL: Execute the DDL to create the database schema for this object.void
createDatabaseSchemaOnDatabase
(AbstractSession session, Set<String> createdDatabaseSchemas) INTERNAL: Execute the DDL to create the database schema for this object.void
createObject
(AbstractSession session, Writer schemaWriter) INTERNAL: Either drop from the database directly or write the statement to a file.void
createOnDatabase
(AbstractSession session) INTERNAL: Execute the DDL to create this object.void
dropDatabaseSchema
(AbstractSession session, Writer writer) INTERNAL: Execute the DDL to drop the database schema for this object.void
INTERNAL: Execute the DDL to drop the database schema for this object.void
dropFromDatabase
(AbstractSession session) INTERNAL: Execute the DDL to drop the object.void
dropObject
(AbstractSession session, Writer schemaWriter, boolean createSQLFiles) INTERNAL: Execute the DDL to drop the object.PUBLIC: Return the database schema associated with this database object.protected static final FieldTypeDefinition
getFieldTypeDefinition
(DatabasePlatform platform, Class<?> type, String name) INTERNAL: Retrieve database platform specific field definition from database specific platform handler for existing type or build a new one when type isnull
and type for type name could not be found.protected static final FieldTypeDefinition
getFieldTypeDefinition
(AbstractSession session, Class<?> type, String name) INTERNAL: Retrieve a database platform specific definition from session for existing type instance or build a new one when type isnull
.INTERNAL: Most major databases support a creator name scope.getName()
PUBLIC: Return the name of the object.PUBLIC: Most major databases support a creator name scope.protected boolean
INTERNAL: Return true is this database object definition has a schema definition.void
postCreateObject
(AbstractSession session, Writer createSchemaWriter, boolean createSQLFiles) Execute any statements required after the creation of the objectvoid
preDropObject
(AbstractSession session, Writer dropSchemaWriter, boolean createSQLFiles) Execute any statements required before the deletion of the objectvoid
PUBLIC: Set the name of the object.void
setQualifier
(String qualifier) PUBLIC: Most major databases support a creator name scope.boolean
shouldCreateDatabaseSchema
(Set<String> createdDatabaseSchemas) INTERNAL: Subclasses who care should override this method, e.g.boolean
shouldCreateVPDCalls
(AbstractSession session) INTERNAL: Subclasses who care should override this method.toString()
-
Field Details
-
name
-
qualifier
-
-
Constructor Details
-
DatabaseObjectDefinition
protected DatabaseObjectDefinition()
-
-
Method Details
-
getFieldTypeDefinition
protected static final FieldTypeDefinition getFieldTypeDefinition(AbstractSession session, Class<?> type, String name) INTERNAL: Retrieve a database platform specific definition from session for existing type instance or build a new one when type isnull
.- Parameters:
session
- Session to search for already existing instances.type
- Field type class.name
- Filed type name.- Returns:
- Database platform specific definition instance.
- Throws:
ValidationException
- when provided type is not valid database type.
-
getFieldTypeDefinition
protected static final FieldTypeDefinition getFieldTypeDefinition(DatabasePlatform platform, Class<?> type, String name) INTERNAL: Retrieve database platform specific field definition from database specific platform handler for existing type or build a new one when type isnull
and type for type name could not be found.- Parameters:
platform
- Specific database platform handler.type
- Field type (will be processed first when available).name
- Field type name (will be processed as backup option when type class is not available).- Throws:
ValidationException
- when provided type is not valid database type.
-
buildCreationWriter
public abstract Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException INTERNAL: Returns the writer used for creation of this object.- Throws:
ValidationException
-
buildVPDCreationPolicyWriter
INTERNAL: Sub classes should override. -
buildVPDCreationFunctionWriter
INTERNAL: Sub classes should override. -
buildVPDDeletionWriter
INTERNAL: Sub classes should override. -
buildDeletionWriter
public abstract Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException INTERNAL: Returns the writer used for deletion of this object.- Throws:
ValidationException
-
clone
PUBLIC: -
createDatabaseSchema
public void createDatabaseSchema(AbstractSession session, Writer writer, Set<String> createdDatabaseSchemas) throws EclipseLinkException INTERNAL: Execute the DDL to create the database schema for this object. Does nothing at this level, subclasses that support this must override this method.- Throws:
EclipseLinkException
- See Also:
-
createDatabaseSchemaOnDatabase
public void createDatabaseSchemaOnDatabase(AbstractSession session, Set<String> createdDatabaseSchemas) throws EclipseLinkException INTERNAL: Execute the DDL to create the database schema for this object. Does nothing at this level, subclasses that support this must override this method.- Throws:
EclipseLinkException
- See Also:
-
createObject
INTERNAL: Either drop from the database directly or write the statement to a file. Database objects are root level entities such as tables, views, procs, sequences...- Throws:
EclipseLinkException
-
createOnDatabase
INTERNAL: Execute the DDL to create this object.- Throws:
EclipseLinkException
-
shouldCreateDatabaseSchema
INTERNAL: Subclasses who care should override this method, e.g. TableDefinition. -
shouldCreateVPDCalls
INTERNAL: Subclasses who care should override this method. -
dropDatabaseSchema
INTERNAL: Execute the DDL to drop the database schema for this object. Does nothing at this level, subclasses that support this must override this method.- Throws:
EclipseLinkException
- See Also:
-
dropDatabaseSchemaOnDatabase
INTERNAL: Execute the DDL to drop the database schema for this object. Does nothing at this level, subclasses that support this must override this method.- Throws:
EclipseLinkException
- See Also:
-
dropFromDatabase
INTERNAL: Execute the DDL to drop the object.- Throws:
EclipseLinkException
-
dropObject
public void dropObject(AbstractSession session, Writer schemaWriter, boolean createSQLFiles) throws EclipseLinkException INTERNAL: Execute the DDL to drop the object. Either directly from the database of write out the statement to a file.- Throws:
EclipseLinkException
-
getDatabaseSchema
PUBLIC: Return the database schema associated with this database object.- See Also:
-
getFullName
INTERNAL: Most major databases support a creator name scope. This means whenever the database object is referenced, it must be qualified. -
getName
PUBLIC: Return the name of the object. i.e. the table name or the sequence name. -
getQualifier
PUBLIC: Most major databases support a creator name scope. This means whenever the database object is referenced, it must be qualified. -
hasDatabaseSchema
protected boolean hasDatabaseSchema()INTERNAL: Return true is this database object definition has a schema definition. -
postCreateObject
public void postCreateObject(AbstractSession session, Writer createSchemaWriter, boolean createSQLFiles) Execute any statements required after the creation of the object -
preDropObject
Execute any statements required before the deletion of the object -
setName
PUBLIC: Set the name of the object. i.e. the table name or the sequence name. -
setQualifier
PUBLIC: Most major databases support a creator name scope. This means whenever the database object is referenced, it must be qualified. -
toString
-