Package org.hibernate.id.enhanced
Class TableStructure
- java.lang.Object
-
- org.hibernate.id.enhanced.TableStructure
-
- All Implemented Interfaces:
ExportableProducer,DatabaseStructure
public class TableStructure extends Object implements DatabaseStructure
Describes a table used to mimic sequence behavior
-
-
Constructor Summary
Constructors Constructor Description TableStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedTableName, Identifier valueColumnNameIdentifier, int initialValue, int incrementSize, Class numberType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessCallbackbuildCallback(SharedSessionContractImplementor session)A callback to be able to get the next value from the underlying structure as needed.intgetIncrementSize()The configured increment sizeintgetInitialValue()The configured initial valueStringgetName()The name of the database structure (table or sequence).intgetTimesAccessed()How many times has this structure been accessed through this reference?booleanisPhysicalSequence()Is the structure physically a sequence?voidprepare(Optimizer optimizer)Prepare this structure for use.voidregisterExportables(Database database)Register the contained exportable things to theDatabaseString[]sqlCreateStrings(Dialect dialect)Commands needed to create the underlying structures.String[]sqlDropStrings(Dialect dialect)Commands needed to drop the underlying structures.
-
-
-
Constructor Detail
-
TableStructure
public TableStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedTableName, Identifier valueColumnNameIdentifier, int initialValue, int incrementSize, Class numberType)
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:DatabaseStructureThe name of the database structure (table or sequence).- Specified by:
getNamein interfaceDatabaseStructure- Returns:
- The structure name.
-
getInitialValue
public int getInitialValue()
Description copied from interface:DatabaseStructureThe configured initial value- Specified by:
getInitialValuein interfaceDatabaseStructure- Returns:
- The configured initial value
-
getIncrementSize
public int getIncrementSize()
Description copied from interface:DatabaseStructureThe configured increment size- Specified by:
getIncrementSizein interfaceDatabaseStructure- Returns:
- The configured increment size
-
getTimesAccessed
public int getTimesAccessed()
Description copied from interface:DatabaseStructureHow many times has this structure been accessed through this reference?- Specified by:
getTimesAccessedin interfaceDatabaseStructure- Returns:
- The number of accesses.
-
prepare
public void prepare(Optimizer optimizer)
Description copied from interface:DatabaseStructurePrepare this structure for use. Called sometime after instantiation, but before first use.- Specified by:
preparein interfaceDatabaseStructure- Parameters:
optimizer- The optimizer being applied to the generator.
-
buildCallback
public AccessCallback buildCallback(SharedSessionContractImplementor session)
Description copied from interface:DatabaseStructureA callback to be able to get the next value from the underlying structure as needed.- Specified by:
buildCallbackin interfaceDatabaseStructure- Parameters:
session- The session.- Returns:
- The next value.
-
sqlCreateStrings
public String[] sqlCreateStrings(Dialect dialect) throws HibernateException
Description copied from interface:DatabaseStructureCommands needed to create the underlying structures.- Specified by:
sqlCreateStringsin interfaceDatabaseStructure- 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:DatabaseStructureCommands needed to drop the underlying structures.- Specified by:
sqlDropStringsin interfaceDatabaseStructure- Parameters:
dialect- The database dialect being used.- Returns:
- The drop commands.
- Throws:
HibernateException
-
isPhysicalSequence
public boolean isPhysicalSequence()
Description copied from interface:DatabaseStructureIs the structure physically a sequence?- Specified by:
isPhysicalSequencein interfaceDatabaseStructure- Returns:
trueif the actual database structure is a sequence;falseotherwise.
-
registerExportables
public void registerExportables(Database database)
Description copied from interface:ExportableProducerRegister the contained exportable things to theDatabase- Specified by:
registerExportablesin interfaceExportableProducer- Parameters:
database- The database instance
-
-