public final class TableGenerator extends org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<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 |
---|---|
protected org.datanucleus.store.connection.ManagedConnection |
connection
Connection to the datastore.
|
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.
|
protected boolean |
repositoryExists
Flag for whether we know that the repository exists.
|
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 |
---|
TableGenerator(org.datanucleus.store.StoreManager storeMgr,
String name,
Properties props)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
createRepository()
Method to create the repository for ids to be stored.
|
static Class |
getStorageClass()
Accessor for the storage class for values generated with this generator.
|
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 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.
|
org.datanucleus.store.valuegenerator.ValueGenerationBlock<Long> |
reserveBlock(long size)
Method to reserve a block of "size" identities.
|
getConnectionPreference, setConnectionProvider
protected org.datanucleus.store.connection.ManagedConnection connection
protected boolean repositoryExists
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(org.datanucleus.store.StoreManager storeMgr, String name, Properties props)
storeMgr
- StoreManagername
- Symbolic name for this generatorprops
- Properties defining the behaviour of this generatorpublic static Class getStorageClass()
public 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 repositoryExists()
protected boolean createRepository()
protected void initialiseSequenceTable()
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.