com.atlassian.crowd.util.persistence.hibernate
Class ResettableTableHiLoGenerator
java.lang.Object
org.hibernate.engine.TransactionHelper
org.hibernate.id.TableGenerator
com.atlassian.crowd.util.persistence.hibernate.ResettableTableHiLoGenerator
- All Implemented Interfaces:
- org.hibernate.id.Configurable, org.hibernate.id.IdentifierGenerator, org.hibernate.id.PersistentIdentifierGenerator
public class ResettableTableHiLoGenerator
- extends org.hibernate.id.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 Hibernate is fetching connections from an application
server datasource or when the user is supplying connections. In these
cases a SequenceHiLoGenerator would be a better choice (where
supported).
Mapping parameters supported: table, column, max_lo
- Author:
- Gavin King
- See Also:
SequenceHiLoGenerator
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 |
Method Summary |
void |
configure(org.hibernate.type.Type type,
Properties params,
org.hibernate.dialect.Dialect d)
|
Serializable |
generate(org.hibernate.engine.SessionImplementor session,
Object obj)
|
int |
getMaxLo()
Get the max_lo value, so that we can calculate a vaid value for the next_hi DB value,
given the ids already allocated in the databse. |
void |
reset()
set the lo value to more than maxLo to force a reset of hival |
String[] |
sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
|
Methods inherited from class org.hibernate.id.TableGenerator |
doWorkInCurrentTransaction, generatorKey, 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 |
MAX_LO
public static final String MAX_LO
- The max_lo parameter
- See Also:
- Constant Field Values
ResettableTableHiLoGenerator
public ResettableTableHiLoGenerator()
configure
public void configure(org.hibernate.type.Type type,
Properties params,
org.hibernate.dialect.Dialect d)
- Specified by:
configure
in interface org.hibernate.id.Configurable
- Overrides:
configure
in class org.hibernate.id.TableGenerator
getMaxLo
public int getMaxLo()
- Get the max_lo value, so that we can calculate a vaid value for the next_hi DB value,
given the ids already allocated in the databse.
generate
public Serializable generate(org.hibernate.engine.SessionImplementor session,
Object obj)
throws org.hibernate.HibernateException
- Specified by:
generate
in interface org.hibernate.id.IdentifierGenerator
- Overrides:
generate
in class org.hibernate.id.TableGenerator
- Throws:
org.hibernate.HibernateException
sqlCreateStrings
public String[] sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
- Specified by:
sqlCreateStrings
in interface org.hibernate.id.PersistentIdentifierGenerator
- Overrides:
sqlCreateStrings
in class org.hibernate.id.TableGenerator
reset
public void reset()
- set the lo value to more than maxLo to force a reset of hival
Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.