Class MaxGenerator
- java.lang.Object
-
- org.datanucleus.store.valuegenerator.AbstractGenerator<T>
-
- org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<java.lang.Long>
-
- org.datanucleus.store.rdbms.valuegenerator.MaxGenerator
-
- All Implemented Interfaces:
org.datanucleus.store.valuegenerator.ValueGenerator<java.lang.Long>
public class MaxGenerator extends org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<java.lang.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.
-
-
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
Constructors Constructor Description MaxGenerator(org.datanucleus.store.StoreManager storeMgr, java.lang.String name, java.util.Properties props)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.datanucleus.store.valuegenerator.AbstractConnectedGenerator.ConnectionPreference
getConnectionPreference()
private java.lang.String
getStatement()
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
-
-
-
-
Method Detail
-
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<java.lang.Long>
- Parameters:
size
- The block size- Returns:
- The reserved block
-
getStatement
private java.lang.String 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<java.lang.Long>
-
-