Save This Page
Home » hibernate-distribution-3.3.1.GA-dist » org.hibernate » id » enhanced » [javadoc | source]
org.hibernate.id.enhanced
public class: SequenceStyleGenerator [javadoc | source]
java.lang.Object
   org.hibernate.id.enhanced.SequenceStyleGenerator

All Implemented Interfaces:
    Configurable, PersistentIdentifierGenerator

Generates identifier values based on an sequence-style database structure. Variations range from actually using a sequence to using a table to mimic a sequence. These variations are encapsulated by the DatabaseStructure interface internally.

General configuration parameters:
NAME DEFAULT DESCRIPTION
#SEQUENCE_PARAM #DEF_SEQUENCE_NAME The name of the sequence/table to use to store/retrieve values
#INITIAL_PARAM #DEFAULT_INITIAL_VALUE The initial value to be stored for the given segment; the effect in terms of storage varies based on Optimizer and DatabaseStructure
#INCREMENT_PARAM #DEFAULT_INCREMENT_SIZE The increment size for the underlying segment; the effect in terms of storage varies based on Optimizer and DatabaseStructure
#OPT_PARAM depends on defined increment size Allows explicit definition of which optimization strategy to use
#FORCE_TBL_PARAM false Allows explicit definition of which optimization strategy to use

Configuration parameters used specifically when the underlying structure is a table:
NAME DEFAULT DESCRIPTION
#VALUE_COLUMN_PARAM #DEF_VALUE_COLUMN The name of column which holds the sequence value for the given segment

Field Summary
public static final  String SEQUENCE_PARAM     
public static final  String DEF_SEQUENCE_NAME     
public static final  String INITIAL_PARAM     
public static final  int DEFAULT_INITIAL_VALUE     
public static final  String INCREMENT_PARAM     
public static final  int DEFAULT_INCREMENT_SIZE     
public static final  String OPT_PARAM     
public static final  String FORCE_TBL_PARAM     
public static final  String VALUE_COLUMN_PARAM     
public static final  String DEF_VALUE_COLUMN     
Method from org.hibernate.id.enhanced.SequenceStyleGenerator Summary:
buildDatabaseStructure,   configure,   determineAdjustedIncrementSize,   determineIncrementSize,   determineInitialValue,   determineOptimizationStrategy,   determineSequenceName,   determineValueColumnName,   generate,   generatorKey,   getDatabaseStructure,   getIdentifierType,   getOptimizer,   sqlCreateStrings,   sqlDropStrings
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.hibernate.id.enhanced.SequenceStyleGenerator Detail:
 protected DatabaseStructure buildDatabaseStructure(Properties params,
    Dialect dialect,
    boolean forceTableUse,
    String sequenceName,
    int initialValue,
    int incrementSize) 
    Build the database structure.
 public  void configure(Type type,
    Properties params,
    Dialect dialect) throws MappingException 
    {@inheritDoc}
 protected int determineAdjustedIncrementSize(String optimizationStrategy,
    int incrementSize) 
    In certain cases we need to adjust the increment size based on the selected optimizer. This is the hook to achieve that.
 protected int determineIncrementSize(Properties params) 
    Determine the increment size to be applied. The exact implications of this value depends on the optimizer being used.

    Called during configuration .

 protected int determineInitialValue(Properties params) 
 protected String determineOptimizationStrategy(Properties params,
    int incrementSize) 
 protected String determineSequenceName(Properties params) 
    Determine the name of the sequence (or table if this resolves to a physical table) to use.

    Called during configuration .

 protected String determineValueColumnName(Properties params) 
    Determine the name of the column used to store the generator value in the db.

    Called during configuration when resolving to a physical table.

 public Serializable generate(SessionImplementor session,
    Object object) throws HibernateException 
    {@inheritDoc}
 public Object generatorKey() 
    {@inheritDoc}
 public DatabaseStructure getDatabaseStructure() 
    Getter for property 'databaseStructure'.
 public Type getIdentifierType() 
    Getter for property 'identifierType'.
 public Optimizer getOptimizer() 
    Getter for property 'optimizer'.
 public String[] sqlCreateStrings(Dialect dialect) throws HibernateException 
    {@inheritDoc}
 public String[] sqlDropStrings(Dialect dialect) throws HibernateException 
    {@inheritDoc}