Class MaxGenerator

java.lang.Object
org.datanucleus.store.valuegenerator.AbstractGenerator<Long>
org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<Long>
org.datanucleus.store.rdbms.valuegenerator.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

    Constructors
    Constructor
    Description
    MaxGenerator(org.datanucleus.store.StoreManager storeMgr, String name, Properties props)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MaxGenerator

      public MaxGenerator(org.datanucleus.store.StoreManager storeMgr, String name, Properties props)
      Constructor.
      Parameters:
      storeMgr - StoreManager
      name - Symbolic name for this generator
      props - 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 class org.datanucleus.store.valuegenerator.AbstractGenerator<Long>
      Parameters:
      size - The block size
      Returns:
      The reserved block
    • getStatement

      private 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 class org.datanucleus.store.valuegenerator.AbstractConnectedGenerator<Long>