public final class SequenceGenerator extends org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<Long>
"select {sequence}.nextval from dual"to get the next value in the sequence. It is datastore-dependent since there is no RDBMS-independent statement. SequenceGenerator works with Longs, so clients using this generator must cast the ID to Long.
Optional user properties
Modifier and Type | Field and Description |
---|---|
protected org.datanucleus.store.connection.ManagedConnection |
connection
Connection to the datastore.
|
protected boolean |
repositoryExists
Flag for whether we know that the repository exists.
|
protected String |
sequenceName
Name of the sequence that we are creating values for
|
connectionProvider, properties
allocationSize, block, initialValue, name, storeMgr
PROPERTY_CATALOG_NAME, PROPERTY_CLASS_NAME, PROPERTY_COLUMN_NAME, PROPERTY_FIELD_NAME, PROPERTY_KEY_CACHE_SIZE, PROPERTY_KEY_DATABASE_CACHE_SIZE, PROPERTY_KEY_INITIAL_VALUE, PROPERTY_KEY_MAX_VALUE, PROPERTY_KEY_MIN_VALUE, PROPERTY_ROOT_CLASS_NAME, PROPERTY_SCHEMA_NAME, PROPERTY_SEQUENCE_NAME, PROPERTY_SEQUENCETABLE_CATALOG, PROPERTY_SEQUENCETABLE_NAME_COLUMN, PROPERTY_SEQUENCETABLE_NEXTVAL_COLUMN, PROPERTY_SEQUENCETABLE_SCHEMA, PROPERTY_SEQUENCETABLE_TABLE, PROPERTY_TABLE_NAME
Constructor and Description |
---|
SequenceGenerator(org.datanucleus.store.StoreManager storeMgr,
String name,
Properties props)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
createRepository()
Method to create the sequence.
|
static Class |
getStorageClass()
Accessor for the storage class for values generated with this generator.
|
protected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> |
obtainGenerationBlock(int number)
Get a new ValueGenerationBlock with the specified number of ids.
|
protected boolean |
repositoryExists()
Method to return if the repository already exists.
|
protected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> |
reserveBlock(long size)
Reserve a block of ids.
|
getConnectionPreference, setConnectionProvider
protected org.datanucleus.store.connection.ManagedConnection connection
protected boolean repositoryExists
protected String sequenceName
public SequenceGenerator(org.datanucleus.store.StoreManager storeMgr, String name, Properties props)
storeMgr
- StoreManagername
- Symbolic name for the generatorprops
- Properties controlling the behaviour of the generatorpublic static Class getStorageClass()
protected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> reserveBlock(long size)
reserveBlock
in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>
size
- Block sizeprotected boolean repositoryExists()
protected boolean createRepository()
protected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> obtainGenerationBlock(int number)
obtainGenerationBlock
in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>
number
- The number of additional ids requiredCopyright © 2019. All rights reserved.