Class TableSequenceDefinition
- java.lang.Object
-
- org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition
-
- org.eclipse.persistence.tools.schemaframework.SequenceDefinition
-
- org.eclipse.persistence.tools.schemaframework.TableSequenceDefinition
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
UnaryTableSequenceDefinition
public class TableSequenceDefinition extends SequenceDefinition
Purpose: Allow a generic way of creating sequences on the different platforms, and allow optional parameters to be specified.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
deleteSchema
protected TableDefinition
tableDefinition
-
Fields inherited from class org.eclipse.persistence.tools.schemaframework.SequenceDefinition
sequence
-
Fields inherited from class org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition
name, qualifier
-
-
Constructor Summary
Constructors Constructor Description TableSequenceDefinition(Sequence sequence, boolean deleteSchema)
INTERNAL: Should be a sequence defining table sequence in the db: either TableSequence DefaultSequence (only if case platform.getDefaultSequence() is a TableSequence).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.Writer
buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
INTERNAL: Return the SQL required to insert the sequence row into the sequence table.java.io.Writer
buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
INTERNAL: Return the SQL to delete the row from the sequence table.TableDefinition
buildTableDefinition()
INTERNAL: Return a TableDefinition specifying sequence table.boolean
checkIfExist(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERAL: Execute the SQL required to insert the sequence row into the sequence table.void
dropDatabaseSchema(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer)
INTERNAL: Execute the DDL to drop the database schema for this object.void
dropDatabaseSchemaOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Execute the DDL to drop the database schema for this object.java.lang.String
getDatabaseSchema()
PUBLIC: Return the schema associated with this table sequence.java.lang.String
getSequenceCounterFieldName()
PUBLIC:java.lang.String
getSequenceNameFieldName()
PUBLIC:org.eclipse.persistence.internal.helper.DatabaseTable
getSequenceTable()
Return the database table for the sequence.java.util.List<IndexDefinition>
getSequenceTableIndexes()
PUBLIC:java.lang.String
getSequenceTableName()
PUBLIC:java.lang.String
getSequenceTableQualifiedName()
PUBLIC:java.lang.String
getSequenceTableQualifier()
PUBLIC:protected TableSequence
getTableSequence()
boolean
isTableSequenceDefinition()
INTERNAL:void
preDropObject(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer dropSchemaWriter, boolean createSQLFiles)
Execute any statements required before the deletion of the objectprotected boolean
shouldDropTableDefinition()
INTERNAL: Returns true if the table definition should be dropped during buildDeletionWriter.-
Methods inherited from class org.eclipse.persistence.tools.schemaframework.SequenceDefinition
alter, alterOnDatabase, createOnDatabase, isAlterSupported
-
Methods inherited from class org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition
buildVPDCreationFunctionWriter, buildVPDCreationPolicyWriter, buildVPDDeletionWriter, clone, createDatabaseSchema, createDatabaseSchemaOnDatabase, createObject, dropFromDatabase, dropObject, getFieldTypeDefinition, getFieldTypeDefinition, getFullName, getName, getQualifier, hasDatabaseSchema, postCreateObject, setName, setQualifier, shouldCreateDatabaseSchema, shouldCreateVPDCalls, toString
-
-
-
-
Field Detail
-
tableDefinition
protected TableDefinition tableDefinition
-
deleteSchema
protected boolean deleteSchema
-
-
Constructor Detail
-
TableSequenceDefinition
public TableSequenceDefinition(Sequence sequence, boolean deleteSchema)
INTERNAL: Should be a sequence defining table sequence in the db: either TableSequence DefaultSequence (only if case platform.getDefaultSequence() is a TableSequence).
-
-
Method Detail
-
buildCreationWriter
public java.io.Writer buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer) throws ValidationException
INTERNAL: Return the SQL required to insert the sequence row into the sequence table. Assume that the sequence table exists.- Specified by:
buildCreationWriter
in classDatabaseObjectDefinition
- Throws:
ValidationException
-
buildDeletionWriter
public java.io.Writer buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer) throws ValidationException
INTERNAL: Return the SQL to delete the row from the sequence table. If we're dealing with create creation, then delegate to the table so that is dropped outright since we will delete the schema.- Specified by:
buildDeletionWriter
in classDatabaseObjectDefinition
- Throws:
ValidationException
-
checkIfExist
public boolean checkIfExist(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DatabaseException
INTERAL: Execute the SQL required to insert the sequence row into the sequence table. Assume that the sequence table exists.- Specified by:
checkIfExist
in classSequenceDefinition
- Throws:
DatabaseException
-
dropDatabaseSchema
public void dropDatabaseSchema(org.eclipse.persistence.internal.sessions.AbstractSession session, java.io.Writer writer) throws EclipseLinkException
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.- Overrides:
dropDatabaseSchema
in classDatabaseObjectDefinition
- Throws:
EclipseLinkException
- See Also:
TableDefinition
-
dropDatabaseSchemaOnDatabase
public void dropDatabaseSchemaOnDatabase(org.eclipse.persistence.internal.sessions.AbstractSession session) throws EclipseLinkException
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.- Overrides:
dropDatabaseSchemaOnDatabase
in classDatabaseObjectDefinition
- Throws:
EclipseLinkException
- See Also:
TableDefinition
-
getDatabaseSchema
public java.lang.String getDatabaseSchema()
PUBLIC: Return the schema associated with this table sequence.- Overrides:
getDatabaseSchema
in classDatabaseObjectDefinition
- See Also:
TableDefinition
-
getSequenceCounterFieldName
public java.lang.String getSequenceCounterFieldName()
PUBLIC:
-
getSequenceNameFieldName
public java.lang.String getSequenceNameFieldName()
PUBLIC:
-
getSequenceTable
public org.eclipse.persistence.internal.helper.DatabaseTable getSequenceTable()
Return the database table for the sequence.
-
getSequenceTableIndexes
public java.util.List<IndexDefinition> getSequenceTableIndexes()
PUBLIC:
-
getSequenceTableName
public java.lang.String getSequenceTableName()
PUBLIC:
-
getSequenceTableQualifier
public java.lang.String getSequenceTableQualifier()
PUBLIC:
-
getSequenceTableQualifiedName
public java.lang.String getSequenceTableQualifiedName()
PUBLIC:
-
buildTableDefinition
public TableDefinition buildTableDefinition()
INTERNAL: Return a TableDefinition specifying sequence table. Cache the table definition for re-use (during CREATE and DROP)- Overrides:
buildTableDefinition
in classSequenceDefinition
-
getTableSequence
protected TableSequence getTableSequence()
-
isTableSequenceDefinition
public boolean isTableSequenceDefinition()
INTERNAL:- Overrides:
isTableSequenceDefinition
in classSequenceDefinition
-
preDropObject
public 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- Overrides:
preDropObject
in classDatabaseObjectDefinition
- Parameters:
session
-dropSchemaWriter
-
-
shouldDropTableDefinition
protected boolean shouldDropTableDefinition()
INTERNAL: Returns true if the table definition should be dropped during buildDeletionWriter.
-
-