Package org.hibernate.id.enhanced
Class SequenceStructure
- java.lang.Object
-
- org.hibernate.id.enhanced.SequenceStructure
-
- All Implemented Interfaces:
ExportableProducer
,DatabaseStructure
- Direct Known Subclasses:
OrderedSequenceStructure
public class SequenceStructure extends java.lang.Object implements DatabaseStructure
Describes a sequence.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
sequenceName
-
Constructor Summary
Constructors Constructor Description SequenceStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedSequenceName, int initialValue, int incrementSize, java.lang.Class numberType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessCallback
buildCallback(SharedSessionContractImplementor session)
A callback to be able to get the next value from the underlying structure as needed.protected void
buildSequence(Database database)
int
getIncrementSize()
The configured increment sizeint
getInitialValue()
The configured initial valuejava.lang.String
getName()
The name of the database structure (table or sequence).protected QualifiedName
getQualifiedName()
protected int
getSourceIncrementSize()
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.void
registerExportables(Database database)
Register the contained exportable things to theDatabase
java.lang.String[]
sqlCreateStrings(Dialect dialect)
Commands needed to create the underlying structures.java.lang.String[]
sqlDropStrings(Dialect dialect)
Commands needed to drop the underlying structures.
-
-
-
Constructor Detail
-
SequenceStructure
public SequenceStructure(JdbcEnvironment jdbcEnvironment, QualifiedName qualifiedSequenceName, int initialValue, int incrementSize, java.lang.Class numberType)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:DatabaseStructure
The name of the database structure (table or sequence).- Specified by:
getName
in interfaceDatabaseStructure
- Returns:
- The structure name.
-
getIncrementSize
public int getIncrementSize()
Description copied from interface:DatabaseStructure
The configured increment size- Specified by:
getIncrementSize
in interfaceDatabaseStructure
- 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 interfaceDatabaseStructure
- Returns:
- The number of accesses.
-
getInitialValue
public int getInitialValue()
Description copied from interface:DatabaseStructure
The configured initial value- Specified by:
getInitialValue
in interfaceDatabaseStructure
- Returns:
- The configured initial value
-
buildCallback
public AccessCallback buildCallback(SharedSessionContractImplementor 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 interfaceDatabaseStructure
- Parameters:
session
- The session.- Returns:
- The next value.
-
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 interfaceDatabaseStructure
- Parameters:
optimizer
- The optimizer being applied to the generator.
-
registerExportables
public void registerExportables(Database database)
Description copied from interface:ExportableProducer
Register the contained exportable things to theDatabase
- Specified by:
registerExportables
in interfaceExportableProducer
- Parameters:
database
- The database instance
-
sqlCreateStrings
public java.lang.String[] sqlCreateStrings(Dialect dialect) throws HibernateException
Description copied from interface:DatabaseStructure
Commands needed to create the underlying structures.- Specified by:
sqlCreateStrings
in interfaceDatabaseStructure
- Parameters:
dialect
- The database dialect being used.- Returns:
- The creation commands.
- Throws:
HibernateException
-
sqlDropStrings
public java.lang.String[] sqlDropStrings(Dialect dialect) throws HibernateException
Description copied from interface:DatabaseStructure
Commands needed to drop the underlying structures.- Specified by:
sqlDropStrings
in interfaceDatabaseStructure
- 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 interfaceDatabaseStructure
- Returns:
true
if the actual database structure is a sequence;false
otherwise.
-
getSourceIncrementSize
protected final int getSourceIncrementSize()
-
getQualifiedName
protected QualifiedName getQualifiedName()
-
buildSequence
protected void buildSequence(Database database)
-
-