public final class SequenceGenerator extends AbstractRDBMSGenerator<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 String |
sequenceName
Name of the sequence that we are creating values for
|
connection| Constructor and Description |
|---|
SequenceGenerator(String name,
Properties props)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
createRepository()
Method to create the sequence.
|
protected String |
getSequenceName()
Accessor for the sequence name to use (fully qualified with catalog/schema).
|
protected boolean |
repositoryExists()
Method to return if the repository already exists.
|
protected boolean |
requiresRepository()
Indicator for whether the generator requires its own repository.
|
protected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> |
reserveBlock(long size)
Reserve a block of ids.
|
obtainGenerationBlock, requiresConnectiongetConnectionPreference, setConnectionProvider, setStoreManagerprotected String sequenceName
public SequenceGenerator(String name, Properties props)
name - Symbolic name for the generatorprops - Properties controlling the behaviour of the generatorprotected org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> reserveBlock(long size)
reserveBlock in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>size - Block sizeprotected String getSequenceName()
protected boolean requiresRepository()
requiresRepository in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>protected boolean repositoryExists()
repositoryExists in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>protected boolean createRepository()
createRepository in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>Copyright © 2017. All rights reserved.