org.hibernate.id

Class SequenceHiLoGenerator

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.IdentifierGenerator

ENTITY_NAME

Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator

CATALOG, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLE, TABLES

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.

Methods inherited from class org.hibernate.id.SequenceGenerator

configure, generate, generatorKey, getSequenceName, sqlCreateStrings, sqlDropStrings

Field Details

MAX_LO

public static final String MAX_LO

Method Details

configure

public void configure(Type type,
                      Properties params,
                      Dialect d)
            throws MappingException
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 interface SequenceGenerator
Parameters:
params - param values, keyed by parameter name

generate

public Serializable generate(SessionImplementor session,
                             Object obj)
            throws HibernateException
Generate a new identifier.
Specified by:
generate in interface IdentifierGenerator
Overrides:
generate in interface SequenceGenerator
Parameters:
session -
Returns:
a new identifier