Top Description Fields Constructors Methods
org.hibernate.id

public Class TableHiLoGenerator

extends TableGenerator
Class Inheritance
Imports
java.io.Serializable, java.util.Properties, org.hibernate.dialect.Dialect, org.hibernate.engine.SessionImplementor, org.hibernate.id.enhanced.AccessCallback, .OptimizerFactory, org.hibernate.type.Type, org.hibernate.util.PropertiesHelper

hilo

An IdentifierGenerator that returns a Long, constructed using a hi/lo algorithm. The hi value MUST be fetched in a separate 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

Modifier and TypeField and Description
private OptimizerFactory.LegacyHiLoAlgorithmOptimizer
public static final String
MAX_LO

The max_lo parameter

private int
Inherited from org.hibernate.id.TableGenerator:
COLUMNDEFAULT_COLUMN_NAMEDEFAULT_TABLE_NAMETABLE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type type, Properties
param values, keyed by parameter name
params
,
Dialect d)

Overrides org.hibernate.id.TableGenerator.configure.

Implements org.hibernate.id.Configurable.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public synchronized Serializable
generate(final SessionImplementor session, Object
the entity or toplevel collection for which the id is being generated
obj
)

Overrides org.hibernate.id.TableGenerator.generate.

Implements org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.
Inherited from org.hibernate.id.TableGenerator:
buildHolderdoWorkInCurrentTransactiongenerateHoldergeneratorKeysqlCreateStringssqlDropStrings

Field Detail

hiloOptimizerback to summary
private OptimizerFactory.LegacyHiLoAlgorithmOptimizer hiloOptimizer
MAX_LOback to summary
public static final String MAX_LO

The max_lo parameter

maxLoback to summary
private int maxLo

Constructor Detail

TableHiLoGeneratorback to summary
public TableHiLoGenerator()

Method Detail

configureback to summary
public void configure(Type type, Properties params, Dialect d)

Overrides org.hibernate.id.TableGenerator.configure.

Implements org.hibernate.id.Configurable.configure.

Doc from org.hibernate.id.Configurable.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.

Parameters
params:Properties

param values, keyed by parameter name

generateback to summary
public synchronized Serializable generate(final SessionImplementor session, Object obj)

Overrides org.hibernate.id.TableGenerator.generate.

Implements org.hibernate.id.IdentifierGenerator.generate.

Doc from org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.

Parameters
obj:Object

the entity or toplevel collection for which the id is being generated

Returns:Serializable

a new identifier