org.hibernate.id.enhanced
Class TableStructure

java.lang.Object
  extended by org.hibernate.id.enhanced.TableStructure
All Implemented Interfaces:
DatabaseStructure

public class TableStructure
extends Object
implements DatabaseStructure

Describes a table used to mimic sequence behavior


Constructor Summary
TableStructure(Dialect dialect, String tableName, String valueColumnName, int initialValue, int incrementSize, Class numberType)
           
 
Method Summary
 AccessCallback buildCallback(SessionImplementor session)
          A callback to be able to get the next value from the underlying structure as needed.
 int getIncrementSize()
          The configured increment size
 int getInitialValue()
          The configured initial value
 String getName()
          The name of the database structure (table or sequence).
 int getTimesAccessed()
          How many times has this structure been accessed through this reference?
 boolean isPhysicalSequence()
          Is the structure physically a sequence?
 void prepare(Optimizer optimizer)
          Prepare this structure for use.
 String[] sqlCreateStrings(Dialect dialect)
          Commands needed to create the underlying structures.
 String[] sqlDropStrings(Dialect dialect)
          Commands needed to drop the underlying structures.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableStructure

public TableStructure(Dialect dialect,
                      String tableName,
                      String valueColumnName,
                      int initialValue,
                      int incrementSize,
                      Class numberType)
Method Detail

getName

public String getName()
Description copied from interface: DatabaseStructure
The name of the database structure (table or sequence).

Specified by:
getName in interface DatabaseStructure
Returns:
The structure name.

getInitialValue

public int getInitialValue()
Description copied from interface: DatabaseStructure
The configured initial value

Specified by:
getInitialValue in interface DatabaseStructure
Returns:
The configured initial value

getIncrementSize

public int getIncrementSize()
Description copied from interface: DatabaseStructure
The configured increment size

Specified by:
getIncrementSize in interface DatabaseStructure
Returns:
The configured increment size

getTimesAccessed

public int getTimesAccessed()
Description copied from interface: DatabaseStructure
How many times has this structure been accessed through this reference?

Specified by:
getTimesAccessed in interface DatabaseStructure
Returns:
The number of accesses.

prepare

public void prepare(Optimizer optimizer)
Description copied from interface: DatabaseStructure
Prepare this structure for use. Called sometime after instantiation, but before first use.

Specified by:
prepare in interface DatabaseStructure
Parameters:
optimizer - The optimizer being applied to the generator.

buildCallback

public AccessCallback buildCallback(SessionImplementor session)
Description copied from interface: DatabaseStructure
A callback to be able to get the next value from the underlying structure as needed.

Specified by:
buildCallback in interface DatabaseStructure
Parameters:
session - The session.
Returns:
The next value.

sqlCreateStrings

public String[] sqlCreateStrings(Dialect dialect)
                          throws HibernateException
Description copied from interface: DatabaseStructure
Commands needed to create the underlying structures.

Specified by:
sqlCreateStrings in interface DatabaseStructure
Parameters:
dialect - The database dialect being used.
Returns:
The creation commands.
Throws:
HibernateException

sqlDropStrings

public String[] sqlDropStrings(Dialect dialect)
                        throws HibernateException
Description copied from interface: DatabaseStructure
Commands needed to drop the underlying structures.

Specified by:
sqlDropStrings in interface DatabaseStructure
Parameters:
dialect - The database dialect being used.
Returns:
The drop commands.
Throws:
HibernateException

isPhysicalSequence

public boolean isPhysicalSequence()
Description copied from interface: DatabaseStructure
Is the structure physically a sequence?

Specified by:
isPhysicalSequence in interface DatabaseStructure
Returns:
true if the actual database structure is a sequence; false otherwise.


Copyright © 2001-2013 Red Hat, Inc. All Rights Reserved.