public class ResettableTableHiLoGenerator extends Object implements org.hibernate.id.PersistentIdentifierGenerator, org.hibernate.id.Configurable
IdentifierGenerator which is compatible with Hibernate 5.
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
| Modifier and Type | Field and Description |
|---|---|
static String |
MAX_LO
The max_lo parameter
|
| Constructor and Description |
|---|
ResettableTableHiLoGenerator() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.hibernate.type.Type type,
Properties params,
org.hibernate.service.ServiceRegistry serviceRegistry) |
Serializable |
generate(org.hibernate.engine.spi.SharedSessionContractImplementor session,
Object obj) |
int |
getMaxLo()
Get the max_lo value, so that we can calculate a valid value for the next_hi DB value,
given the ids already allocated in the database.
|
void |
initialize(org.hibernate.boot.model.relational.SqlStringGenerationContext context) |
void |
registerExportables(org.hibernate.boot.model.relational.Database database) |
void |
reset()
Set the lo value to more than maxLo to force a reset of the hi value.
|
boolean |
supportsJdbcBatchInserts() |
public static final String MAX_LO
public void configure(org.hibernate.type.Type type,
Properties params,
org.hibernate.service.ServiceRegistry serviceRegistry)
throws org.hibernate.MappingException
configure in interface org.hibernate.id.Configurableconfigure in interface org.hibernate.id.IdentifierGeneratororg.hibernate.MappingExceptionpublic void initialize(org.hibernate.boot.model.relational.SqlStringGenerationContext context)
initialize in interface org.hibernate.id.IdentifierGeneratorpublic boolean supportsJdbcBatchInserts()
supportsJdbcBatchInserts in interface org.hibernate.id.IdentifierGeneratorpublic Serializable generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object obj) throws org.hibernate.HibernateException
generate in interface org.hibernate.id.IdentifierGeneratororg.hibernate.HibernateExceptionpublic void reset()
public void registerExportables(org.hibernate.boot.model.relational.Database database)
registerExportables in interface org.hibernate.boot.model.relational.ExportableProducerregisterExportables in interface org.hibernate.id.IdentifierGeneratorpublic int getMaxLo()
Copyright © 2024 Atlassian Software Systems Pty Ltd. All rights reserved.