public final class TableGenerator extends AbstractRDBMSGenerator<Long>
The following properties define the name of the sequence being generated. If "sequence-name" is specified then it is used. Otherwise the name of the sequence will either be based on the table name or the class name (for what we are generating the ids).
The following properties define the table where the identities are generated.
The following properties control the initial value, and the number of ids that are cached (generated) in each call.
The following properties are used when finding the starting point for the identities generated.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NEXTVALUE_COLUMN_NAME
Default name for the column storing the next value of the sequence.
|
static String |
DEFAULT_SEQUENCE_COLUMN_NAME
Default name for the column storing the name of the sequence.
|
static String |
DEFAULT_TABLE_NAME
Default name for the datastore table storing the sequence values.
|
connection
Constructor and Description |
---|
TableGenerator(String name,
Properties props)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
createRepository()
Method to create the repository for ids to be stored.
|
SequenceTable |
getTable()
Convenience accessor for the table being used.
|
protected void |
initialiseSequenceTable()
Method to initialise the sequence table used for storing the sequence values.
|
protected boolean |
repositoryExists()
Method to return if the repository already exists.
|
protected boolean |
requiresRepository()
Indicator for whether the generator requires its own repository.
|
org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> |
reserveBlock(long size)
Method to reserve a block of "size" identities.
|
obtainGenerationBlock, requiresConnection
getConnectionPreference, setConnectionProvider, setStoreManager
public static final String DEFAULT_TABLE_NAME
public static final String DEFAULT_SEQUENCE_COLUMN_NAME
public static final String DEFAULT_NEXTVALUE_COLUMN_NAME
public TableGenerator(String name, Properties props)
name
- Symbolic name for this generatorprops
- Properties defining the behaviour of this generatorpublic SequenceTable getTable()
public org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> reserveBlock(long size)
reserveBlock
in class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>
size
- Block sizeprotected 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>
protected void initialiseSequenceTable()
Copyright © 2015. All rights reserved.