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

public Class TableStructure

extends Object
implements DatabaseStructure
Class Inheritance
All Implemented Interfaces
org.hibernate.id.enhanced.DatabaseStructure, org.hibernate.boot.model.relational.ExportableProducer
Imports
java.sql.Connection, .PreparedStatement, .ResultSet, .SQLException, org.hibernate.AssertionFailure, .LockMode, org.hibernate.boot.model.naming.Identifier, org.hibernate.boot.model.relational.Database, .InitCommand, .Namespace, .QualifiedName, .SqlStringGenerationContext, org.hibernate.dialect.Dialect, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment, org.hibernate.engine.jdbc.internal.FormatStyle, org.hibernate.engine.jdbc.spi.JdbcServices, .SqlStatementLogger, org.hibernate.engine.spi.SessionEventListenerManager, .SharedSessionContractImplementor, org.hibernate.id.ExportableColumn, .IdentifierGenerationException, .IdentifierGeneratorHelper, .IntegralDataTypeHolder, org.hibernate.internal.CoreMessageLogger, org.hibernate.jdbc.AbstractReturningWork, org.hibernate.mapping.Table, org.hibernate.type.LongType, org.jboss.logging.Logger

Describes a table used to mimic sequence behavior
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private int
private boolean
private String
private final int
private final int
private static final CoreMessageLogger
private final QualifiedName
private final Identifier
private final Class<T>
private QualifiedName
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
TableStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedTableName, Identifier valueColumnNameIdentifier, int initialValue, int incrementSize, Class<T> numberType)

Method Summary

Modifier and TypeMethod and Description
public AccessCallback
buildCallback(final SharedSessionContractImplementor
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.
private ResultSet
private int
public String[]
public int
public int
public String
getName()

Overrides default org.hibernate.id.enhanced.DatabaseStructure.getName.

Deprecated
The name of the database structure (table or sequence).
public QualifiedName
getPhysicalName()

Implements org.hibernate.id.enhanced.DatabaseStructure.getPhysicalName.

The physical 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
initialize(SqlStringGenerationContext
A context to help generate SQL strings
context
)

Overrides default org.hibernate.id.enhanced.DatabaseStructure.initialize.

Initializes this structure, in particular pre-generates SQL as necessary.
public boolean
isPhysicalSequence()

Implements org.hibernate.id.enhanced.DatabaseStructure.isPhysicalSequence.

Is the structure physically a sequence?
private IntegralDataTypeHolder
public void
prepare(Optimizer
The optimizer being applied to the generator.
optimizer
)

Overrides default org.hibernate.id.enhanced.DatabaseStructure.prepare.

Prepare this structure for use.
private PreparedStatement
prepareStatement(Connection connection, String sql, SqlStatementLogger statementLogger, SessionEventListenerManager statsCollector)

public void
registerExportables(Database
The database instance
database
)

Implements org.hibernate.id.enhanced.DatabaseStructure.registerExportables.

Register database objects involved in this structure, e.g. sequences, tables, etc.

This method is called just once, after configure(Optimizer), but before initialize(SqlStringGenerationContext).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessCounterback to summary
private int accessCounter
applyIncrementSizeToSourceValuesback to summary
private boolean applyIncrementSizeToSourceValues
formattedTableNameForLegacyGetterback to summary
private String formattedTableNameForLegacyGetter

Deprecated

Annotations
@Deprecated
incrementSizeback to summary
private final int incrementSize
initialValueback to summary
private final int initialValue
LOGback to summary
private static final CoreMessageLogger LOG
logicalQualifiedTableNameback to summary
private final QualifiedName logicalQualifiedTableName
logicalValueColumnNameIdentifierback to summary
private final Identifier logicalValueColumnNameIdentifier
numberTypeback to summary
private final Class<T> numberType
physicalTableNameback to summary
private QualifiedName physicalTableName
selectQueryback to summary
private String selectQuery
updateQueryback to summary
private String updateQuery
valueColumnNameTextback to summary
private String valueColumnNameText

Constructor Detail

TableStructureback to summary
public TableStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedTableName, Identifier valueColumnNameIdentifier, int initialValue, int incrementSize, Class<T> numberType)

Method Detail

buildCallbackback to summary
public AccessCallback buildCallback(final SharedSessionContractImplementor 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:SharedSessionContractImplementor

The session.

Returns:AccessCallback

The next value.

Annotations
@Override
executeQueryback to summary
private ResultSet executeQuery(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException
executeUpdateback to summary
private int executeUpdate(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException
getAllSqlForTestsback to summary
public String[] getAllSqlForTests()

Overrides default org.hibernate.id.enhanced.DatabaseStructure.getAllSqlForTests.

Annotations
@Override
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

Annotations
@Override
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

Annotations
@Override
getNameback to summary
public String getName()

Overrides default org.hibernate.id.enhanced.DatabaseStructure.getName.

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

Deprecated

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

Annotations
@Override
@Deprecated
getPhysicalNameback to summary
public QualifiedName getPhysicalName()

Implements org.hibernate.id.enhanced.DatabaseStructure.getPhysicalName.

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

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

Only available after registerExportables(Database) has been called.

Returns:QualifiedName

The structure name.

Annotations
@Override
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.

Annotations
@Override
initializeback to summary
public void initialize(SqlStringGenerationContext context)

Overrides default org.hibernate.id.enhanced.DatabaseStructure.initialize.

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

Initializes this structure, in particular pre-generates SQL as necessary.

This method is called just once, after registerExportables(Database), before first use.

Parameters
context:SqlStringGenerationContext

A context to help generate SQL strings

Annotations
@Override
isPhysicalSequenceback to summary
public boolean isPhysicalSequence()

Implements org.hibernate.id.enhanced.DatabaseStructure.isPhysicalSequence.

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

Is the structure physically a sequence?

Returns:boolean

true if the actual database structure is a sequence; false otherwise.

Annotations
@Override
makeValueback to summary
private IntegralDataTypeHolder makeValue()
prepareback to summary
public void prepare(Optimizer optimizer)

Overrides default 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.

Annotations
@Override
prepareStatementback to summary
private PreparedStatement prepareStatement(Connection connection, String sql, SqlStatementLogger statementLogger, SessionEventListenerManager statsCollector) throws SQLException
registerExportablesback to summary
public void registerExportables(Database database)

Implements org.hibernate.id.enhanced.DatabaseStructure.registerExportables.

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

Register database objects involved in this structure, e.g. sequences, tables, etc.

This method is called just once, after configure(Optimizer), but before initialize(SqlStringGenerationContext).

Parameters
database:Database

The database instance

Annotations
@Override