Class SequenceTable
- java.lang.Object
-
- org.datanucleus.store.rdbms.table.AbstractTable
-
- org.datanucleus.store.rdbms.table.TableImpl
-
- org.datanucleus.store.rdbms.valuegenerator.SequenceTable
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.table.AbstractTable
columns, columnsByIdentifier, dba, existsInDatastore, identifier, state, storeMgr, TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED
-
-
Constructor Summary
Constructors Constructor Description SequenceTable(DatastoreIdentifier identifier, RDBMSStoreManager storeMgr, String seqNameColName, String nextValColName)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteAllSequences(org.datanucleus.store.connection.ManagedConnection conn)Method to delete all sequencesvoiddeleteSequence(String sequenceName, org.datanucleus.store.connection.ManagedConnection conn)Method to delete a sequence.HashSetgetFetchAllSequences(org.datanucleus.store.connection.ManagedConnection conn)Accessor for the sequencesJavaTypeMappinggetIdMapping()Accessor for a mapping for the ID (persistable) for this table.JavaTypeMappinggetMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)Accessor the for the mapping for a field store in this tableLonggetNextVal(String sequenceName, org.datanucleus.store.connection.ManagedConnection conn, int incrementBy, DatastoreIdentifier tableIdentifier, String columnName, int initialValue)Accessor for the nextval of a sequencevoidinitialize(org.datanucleus.ClassLoaderResolver clr)Method to initialise the table.-
Methods inherited from class org.datanucleus.store.rdbms.table.TableImpl
createConstraints, dropConstraints, getExpectedCandidateKeys, getExpectedForeignKeys, getExpectedIndices, getPrimaryKey, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, logMapping, postInitialize, preInitialize, validate, validateColumns, validateConstraints, validatePrimaryKey
-
Methods inherited from class org.datanucleus.store.rdbms.table.AbstractTable
addColumn, addColumnInternal, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getClassMetaData, getColumn, getColumnForName, getColumnForPosition, getColumns, getDatastoreIdentifierFullyQualified, getDiscriminatorMetaData, getIdentifier, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getName, getNumberOfColumns, getSchemaName, getStoreManager, getSurrogateColumn, getSurrogateMapping, getVersionMetaData, hasColumn, hasColumnName, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, tableExistsInDatastore, toString
-
-
-
-
Constructor Detail
-
SequenceTable
public SequenceTable(DatastoreIdentifier identifier, RDBMSStoreManager storeMgr, String seqNameColName, String nextValColName)
Constructor- Parameters:
identifier- Datastore identifier for this tablestoreMgr- The RDBMSManager for this datastoreseqNameColName- Name for the "sequence name" columnnextValColName- Name for the "next value" column
-
-
Method Detail
-
initialize
public void initialize(org.datanucleus.ClassLoaderResolver clr)
Method to initialise the table.- Parameters:
clr- The ClassLoaderResolver
-
getIdMapping
public JavaTypeMapping getIdMapping()
Accessor for a mapping for the ID (persistable) for this table.- Returns:
- The (persistable) ID mapping.
-
getFetchAllSequences
public HashSet getFetchAllSequences(org.datanucleus.store.connection.ManagedConnection conn) throws SQLException
Accessor for the sequences- Parameters:
conn- Connection for this datastore.- Returns:
- The HashSet of Sequence names
- Throws:
SQLException- Thrown when an error occurs in the process.
-
getNextVal
public Long getNextVal(String sequenceName, org.datanucleus.store.connection.ManagedConnection conn, int incrementBy, DatastoreIdentifier tableIdentifier, String columnName, int initialValue) throws SQLException
Accessor for the nextval of a sequence- Parameters:
conn- Connection for this datastore.sequenceName- The sequence name (the key)incrementBy- The amount to increment (from the current value)tableIdentifier- Identifier for the table being incremented (used when there is no current value)columnName- Name of the column being incremented (used when there is no current value)initialValue- Initial value (if not using tableIdentifier/columnName to find the initial value)- Returns:
- The next value that should be used
- Throws:
SQLException- Thrown when an error occurs in the process.
-
deleteSequence
public void deleteSequence(String sequenceName, org.datanucleus.store.connection.ManagedConnection conn) throws SQLException
Method to delete a sequence.- Parameters:
sequenceName- Name of the sequenceconn- Connection to the datastore- Throws:
SQLException- Thrown when an error occurs deleting the schema.
-
deleteAllSequences
public void deleteAllSequences(org.datanucleus.store.connection.ManagedConnection conn) throws SQLExceptionMethod to delete all sequences- Parameters:
conn- Connection to the datastore- Throws:
SQLException- Thrown when an error occurs deleting.
-
getMemberMapping
public JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor the for the mapping for a field store in this table- Parameters:
mmd- MetaData for the field whose mapping we want- Returns:
- The mapping
-
-