Package org.hibernate.id
Class TableHiLoGenerator
java.lang.Object
org.hibernate.engine.TransactionHelper
org.hibernate.id.TableGenerator
org.hibernate.id.TableHiLoGenerator
- All Implemented Interfaces:
Configurable,IdentifierGenerator,PersistentIdentifierGenerator
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
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
- See Also:
-
Field Summary
FieldsFields inherited from class org.hibernate.id.TableGenerator
COLUMN, DEFAULT_COLUMN_NAME, DEFAULT_TABLE_NAME, TABLEFields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAMEFields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Type type, Properties params, Dialect d) Configure this instance, given the value of parameters specified by the user as <param> elements.generate(SessionImplementor session, Object obj) Generate a new identifier.Methods inherited from class org.hibernate.id.TableGenerator
buildHolder, doWorkInCurrentTransaction, generateHolder, generatorKey, sqlCreateStrings, sqlDropStringsMethods inherited from class org.hibernate.engine.TransactionHelper
doWorkInNewTransaction
-
Field Details
-
MAX_LO
The max_lo parameter- See Also:
-
-
Constructor Details
-
TableHiLoGenerator
public TableHiLoGenerator()
-
-
Method Details
-
configure
Description copied from interface:ConfigurableConfigure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classTableGenerator- Parameters:
params- param values, keyed by parameter name
-
generate
Description copied from interface:IdentifierGeneratorGenerate a new identifier.- Specified by:
generatein interfaceIdentifierGenerator- Overrides:
generatein classTableGenerator- Parameters:
session-obj- the entity or toplevel collection for which the id is being generated- Returns:
- a new identifier
-