public class

ResettableTableHiLoGenerator

extends TableGenerator
java.lang.Object
   ↳ net.sf.hibernate.id.TableGenerator
     ↳ com.atlassian.hibernate.ResettableTableHiLoGenerator

Class Overview

A variant on Hibernate's HiLoGenerator that allows us to force a reload of the HI value. This is necessary because after an import or restore, the hi value in the generator may overlap with IDs already assigned in the database.

Note: calling reset() does not ensure that the hi value that we get from the database is correct. If you've imported data with pre-set IDs you'll need something like Confluence's HiLoIdRepairUpgradeTask to set the hi value to a sane value before resetting the generator.

Summary

Constants
String MAX_LO The max_lo parameter
[Expand]
Inherited Constants
From class net.sf.hibernate.id.TableGenerator
From interface net.sf.hibernate.id.PersistentIdentifierGenerator
Public Constructors
ResettableTableHiLoGenerator()
Public Methods
void configure(Type type, Properties params, Dialect d)
synchronized Serializable generate(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.
synchronized void reset()
set the lo value to more than maxLo to force a reset of hival
[Expand]
Inherited Methods
From class net.sf.hibernate.id.TableGenerator
From class java.lang.Object
From interface net.sf.hibernate.id.Configurable
From interface net.sf.hibernate.id.IdentifierGenerator
From interface net.sf.hibernate.id.PersistentIdentifierGenerator

Constants

public static final String MAX_LO

The max_lo parameter

Constant Value: "max_lo"

Public Constructors

public ResettableTableHiLoGenerator ()

Public Methods

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

public synchronized Serializable generate (SessionImplementor session, Object obj)

Throws
SQLException
HibernateException

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.

public synchronized void reset ()

set the lo value to more than maxLo to force a reset of hival