org.hibernate.id
Class TableHiLoGenerator

java.lang.Object
  extended by org.hibernate.engine.TransactionHelper
      extended by org.hibernate.id.TableGenerator
          extended by org.hibernate.id.TableHiLoGenerator
All Implemented Interfaces:
Configurable, IdentifierGenerator, PersistentIdentifierGenerator

public class TableHiLoGenerator
extends TableGenerator

hilo

An IdentifierGenerator that returns a Long, constructed using a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction to the Session transaction so the generator must be able to obtain a new connection and commit it. Hence this implementation may not be used when the user is supplying connections. In this case a SequenceHiLoGenerator would be a better choice (where supported).

Mapping parameters supported: table, column, max_lo

Author:
Gavin King
See Also:
SequenceHiLoGenerator

Field Summary
static String MAX_LO
          The max_lo parameter
 
Fields inherited from class org.hibernate.id.TableGenerator
COLUMN, DEFAULT_COLUMN_NAME, DEFAULT_TABLE_NAME, TABLE
 
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, PK, SCHEMA, SQL, TABLES
 
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME
 
Constructor Summary
TableHiLoGenerator()
           
 
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.TableGenerator
doWorkInCurrentTransaction, generatorKey, sqlCreateStrings, sqlDropStrings
 
Methods inherited from class org.hibernate.engine.TransactionHelper
doWorkInNewTransaction
 
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
The max_lo parameter

See Also:
Constant Field Values
Constructor Detail

TableHiLoGenerator

public TableHiLoGenerator()
Method Detail

configure

public void configure(Type type,
                      Properties params,
                      Dialect d)
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 TableGenerator
params - param values, keyed by parameter name

generate

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

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