org.hibernate.id
Class SequenceHiLoGenerator

java.lang.Object
  extended by org.hibernate.id.SequenceGenerator
      extended by org.hibernate.id.SequenceHiLoGenerator
All Implemented Interfaces:
Configurable, IdentifierGenerator, PersistentIdentifierGenerator

public class SequenceHiLoGenerator
extends SequenceGenerator

seqhilo

An IdentifierGenerator that combines a hi/lo algorithm with an underlying oracle-style sequence that generates hi values. The user may specify a maximum lo value to determine how often new hi values are fetched.

If sequences are not available, TableHiLoGenerator might be an alternative.

Mapping parameters supported: sequence, max_lo, parameters.

Author:
Gavin King
See Also:
TableHiLoGenerator

Field Summary
static String MAX_LO
           
 
Fields inherited from class org.hibernate.id.SequenceGenerator
PARAMETERS, SEQUENCE
 
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLE, TABLES
 
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME
 
Constructor Summary
SequenceHiLoGenerator()
           
 
Method Summary
 void configure(Type type, Properties params, Dialect d)
          Configure this instance, given the value of parameters specified by the user as <param> elements.
 Serializable generate(SessionImplementor session, Object obj)
          Generate a new identifier.
 OptimizerFactory.LegacyHiLoAlgorithmOptimizer getHiloOptimizer()
           
 
Methods inherited from class org.hibernate.id.SequenceGenerator
buildHolder, generateHolder, generatorKey, getIdentifierType, getSequenceName, sqlCreateStrings, sqlDropStrings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LO

public static final String MAX_LO
See Also:
Constant Field Values
Constructor Detail

SequenceHiLoGenerator

public SequenceHiLoGenerator()
Method Detail

configure

public void configure(Type type,
                      Properties params,
                      Dialect d)
               throws MappingException
Description copied from interface: Configurable
Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.

Specified by:
configure in interface Configurable
Overrides:
configure in class SequenceGenerator
params - param values, keyed by parameter name
Throws:
MappingException

generate

public Serializable generate(SessionImplementor session,
                             Object obj)
Description copied from interface: IdentifierGenerator
Generate a new identifier.

Specified by:
generate in interface IdentifierGenerator
Overrides:
generate in class SequenceGenerator
obj - the entity or toplevel collection for which the id is being generated
Returns:
a new identifier

getHiloOptimizer

public OptimizerFactory.LegacyHiLoAlgorithmOptimizer getHiloOptimizer()


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.