Class MaxGenerator
- All Implemented Interfaces:
org.datanucleus.store.valuegenerator.ValueGenerator<Long>
public class MaxGenerator
extends org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<Long>
ValueGenerator for RDBMS that uses the "SELECT MAX(column) FROM TABLE" strategy.
The allocation size is limited to 1.
This works with numbers, so clients using this generator must cast the ID to Long.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.datanucleus.store.valuegenerator.AbstractConnectedGenerator
org.datanucleus.store.valuegenerator.AbstractConnectedGenerator.ConnectionPreference
-
Field Summary
Fields inherited from class org.datanucleus.store.valuegenerator.AbstractConnectedGenerator
connectionProvider, properties
Fields inherited from class org.datanucleus.store.valuegenerator.AbstractGenerator
allocationSize, block, initialValue, name, storeMgr
Fields inherited from interface org.datanucleus.store.valuegenerator.ValueGenerator
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 Summary
ConstructorsConstructorDescriptionMaxGenerator
(org.datanucleus.store.StoreManager storeMgr, String name, Properties props) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.datanucleus.store.valuegenerator.AbstractConnectedGenerator.ConnectionPreference
private String
Return the SQL statement.org.datanucleus.store.valuegenerator.ValueGenerationBlock
reserveBlock
(long size) Method to reserve a block of identities.Methods inherited from class org.datanucleus.store.valuegenerator.AbstractConnectedGenerator
setConnectionProvider
Methods inherited from class org.datanucleus.store.valuegenerator.AbstractGenerator
allocate, current, currentValue, getName, next, nextValue, obtainGenerationBlock, obtainGenerationBlock, reserveBlock
-
Constructor Details
-
MaxGenerator
Constructor.- Parameters:
storeMgr
- StoreManagername
- Symbolic name for this generatorprops
- Properties defining the behaviour of this generator
-
-
Method Details
-
reserveBlock
public org.datanucleus.store.valuegenerator.ValueGenerationBlock reserveBlock(long size) Method to reserve a block of identities. Note : Only allocates a single id always.- Specified by:
reserveBlock
in classorg.datanucleus.store.valuegenerator.AbstractGenerator<Long>
- Parameters:
size
- The block size- Returns:
- The reserved block
-
getStatement
Return the SQL statement. TODO Allow this to work in different catalog/schema- Returns:
- statement
-
getConnectionPreference
public org.datanucleus.store.valuegenerator.AbstractConnectedGenerator.ConnectionPreference getConnectionPreference()- Overrides:
getConnectionPreference
in classorg.datanucleus.store.valuegenerator.AbstractConnectedGenerator<Long>
-