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) |
Object |
generatorKey() |
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 |
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.
|
String[] |
sqlCreateStrings(org.hibernate.dialect.Dialect dialect) |
String[] |
sqlDropStrings(org.hibernate.dialect.Dialect dialect) |
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.Configurable
org.hibernate.MappingException
public Serializable generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object obj) throws org.hibernate.HibernateException
generate
in interface org.hibernate.id.IdentifierGenerator
org.hibernate.HibernateException
public void reset()
public String[] sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
sqlCreateStrings
in interface org.hibernate.id.PersistentIdentifierGenerator
public String[] sqlDropStrings(org.hibernate.dialect.Dialect dialect) throws org.hibernate.HibernateException
sqlDropStrings
in interface org.hibernate.id.PersistentIdentifierGenerator
org.hibernate.HibernateException
public Object generatorKey()
generatorKey
in interface org.hibernate.id.PersistentIdentifierGenerator
public void registerExportables(org.hibernate.boot.model.relational.Database database)
registerExportables
in interface org.hibernate.boot.model.relational.ExportableProducer
public int getMaxLo()
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.