Top Description Fields Constructors Methods
org.hibernate.id.enhanced

public Class TableStructure

extends TransactionHelper
implements DatabaseStructure
Class Inheritance
All Implemented Interfaces
org.hibernate.id.enhanced.DatabaseStructure
Imports
java.io.Serializable, java.sql.Connection, .PreparedStatement, .ResultSet, .SQLException, .Types, org.slf4j.Logger, .LoggerFactory, org.hibernate.HibernateException, .LockMode, org.hibernate.dialect.Dialect, org.hibernate.engine.SessionImplementor, .TransactionHelper, org.hibernate.id.IdentifierGenerationException, .IdentifierGeneratorHelper, .IntegralDataTypeHolder, org.hibernate.jdbc.util.FormatStyle, .SQLStatementLogger

Describes a table used to mimic sequence behavior
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private int
private boolean
private final int
private final int
private static final Logger
private final Class<T>
private final String
private static final SQLStatementLogger
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
TableStructure(Dialect dialect, String tableName, String valueColumnName, int initialValue, int incrementSize, Class<T> numberType)

Method Summary

Modifier and TypeMethod and Description
public AccessCallback
buildCallback(final SessionImplementor
The session.
session
)

Implements org.hibernate.id.enhanced.DatabaseStructure.buildCallback.

A callback to be able to get the next value from the underlying structure as needed.
protected Serializable
public int
public int
public String
getName()

Implements org.hibernate.id.enhanced.DatabaseStructure.getName.

The name of the database structure (table or sequence).
public int
getTimesAccessed()

Implements org.hibernate.id.enhanced.DatabaseStructure.getTimesAccessed.

How many times has this structure been accessed through this reference?
public void
prepare(Optimizer
The optimizer being applied to the generator.
optimizer
)

Implements org.hibernate.id.enhanced.DatabaseStructure.prepare.

Prepare this structure for use.
public String[]
sqlCreateStrings(Dialect
The database dialect being used.
dialect
)

Implements org.hibernate.id.enhanced.DatabaseStructure.sqlCreateStrings.

Commands needed to create the underlying structures.
public String[]
sqlDropStrings(Dialect
The database dialect being used.
dialect
)

Implements org.hibernate.id.enhanced.DatabaseStructure.sqlDropStrings.

Commands needed to drop the underlying structures.
Inherited from org.hibernate.engine.TransactionHelper:
doWorkInNewTransaction

Field Detail

accessCounterback to summary
private int accessCounter
applyIncrementSizeToSourceValuesback to summary
private boolean applyIncrementSizeToSourceValues
incrementSizeback to summary
private final int incrementSize
initialValueback to summary
private final int initialValue
logback to summary
private static final Logger log
numberTypeback to summary
private final Class<T> numberType
selectQueryback to summary
private final String selectQuery
SQL_STATEMENT_LOGGERback to summary
private static final SQLStatementLogger SQL_STATEMENT_LOGGER
tableNameback to summary
private final String tableName
updateQueryback to summary
private final String updateQuery
valueColumnNameback to summary
private final String valueColumnName

Constructor Detail

TableStructureback to summary
public TableStructure(Dialect dialect, String tableName, String valueColumnName, int initialValue, int incrementSize, Class<T> numberType)

Method Detail

buildCallbackback to summary
public AccessCallback buildCallback(final SessionImplementor session)

Implements org.hibernate.id.enhanced.DatabaseStructure.buildCallback.

Doc from org.hibernate.id.enhanced.DatabaseStructure.buildCallback.

A callback to be able to get the next value from the underlying structure as needed.

Parameters
session:SessionImplementor

The session.

Returns:AccessCallback

The next value.

doWorkInCurrentTransactionback to summary
protected Serializable doWorkInCurrentTransaction(Connection conn, String sql) throws SQLException

Implements abstract org.hibernate.engine.TransactionHelper.doWorkInCurrentTransaction.

Doc from org.hibernate.engine.TransactionHelper.doWorkInCurrentTransaction.

The work to be done

getIncrementSizeback to summary
public int getIncrementSize()

Implements org.hibernate.id.enhanced.DatabaseStructure.getIncrementSize.

Doc from org.hibernate.id.enhanced.DatabaseStructure.getIncrementSize.

The configured increment size

Returns:int

The configured increment size

getInitialValueback to summary
public int getInitialValue()

Implements org.hibernate.id.enhanced.DatabaseStructure.getInitialValue.

Doc from org.hibernate.id.enhanced.DatabaseStructure.getInitialValue.

The configured initial value

Returns:int

The configured initial value

getNameback to summary
public String getName()

Implements org.hibernate.id.enhanced.DatabaseStructure.getName.

Doc from org.hibernate.id.enhanced.DatabaseStructure.getName.

The name of the database structure (table or sequence).

Returns:String

The structure name.

getTimesAccessedback to summary
public int getTimesAccessed()

Implements org.hibernate.id.enhanced.DatabaseStructure.getTimesAccessed.

Doc from org.hibernate.id.enhanced.DatabaseStructure.getTimesAccessed.

How many times has this structure been accessed through this reference?

Returns:int

The number of accesses.

prepareback to summary
public void prepare(Optimizer optimizer)

Implements org.hibernate.id.enhanced.DatabaseStructure.prepare.

Doc from org.hibernate.id.enhanced.DatabaseStructure.prepare.

Prepare this structure for use. Called sometime after instantiation, but before first use.

Parameters
optimizer:Optimizer

The optimizer being applied to the generator.

sqlCreateStringsback to summary
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException

Implements org.hibernate.id.enhanced.DatabaseStructure.sqlCreateStrings.

Doc from org.hibernate.id.enhanced.DatabaseStructure.sqlCreateStrings.

Commands needed to create the underlying structures.

Parameters
dialect:Dialect

The database dialect being used.

Returns:String[]

The creation commands.

sqlDropStringsback to summary
public String[] sqlDropStrings(Dialect dialect) throws HibernateException

Implements org.hibernate.id.enhanced.DatabaseStructure.sqlDropStrings.

Doc from org.hibernate.id.enhanced.DatabaseStructure.sqlDropStrings.

Commands needed to drop the underlying structures.

Parameters
dialect:Dialect

The database dialect being used.

Returns:String[]

The drop commands.