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 Object implements DatabaseStructure
Describes a sequence.
-
-
Field Summary
Fields Modifier and Type Field Description protected QualifiedName
physicalSequenceName
-
Constructor Summary
Constructors Constructor Description SequenceStructure(JdbcEnvironment jdbcEnvironment, String contributor, QualifiedName qualifiedSequenceName, int initialValue, int incrementSize, 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)
void
configure(Optimizer optimizer)
Configures this structure with the given arguments.String[]
getAllSqlForTests()
int
getIncrementSize()
The configured increment sizeint
getInitialValue()
The configured initial valueQualifiedName
getPhysicalName()
The physical 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?void
initialize(SqlStringGenerationContext context)
Initializes this structure, in particular pre-generates SQL as necessary.boolean
isPhysicalSequence()
Is the structure physically a sequence?void
registerExportables(Database database)
Register database objects involved in this structure, e.g.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.id.enhanced.DatabaseStructure
prepare
-
-
-
-
Field Detail
-
physicalSequenceName
protected QualifiedName physicalSequenceName
-
-
Constructor Detail
-
SequenceStructure
public SequenceStructure(JdbcEnvironment jdbcEnvironment, String contributor, QualifiedName qualifiedSequenceName, int initialValue, int incrementSize, Class numberType)
-
-
Method Detail
-
getPhysicalName
public QualifiedName getPhysicalName()
Description copied from interface:DatabaseStructure
The physical name of the database structure (table or sequence).Only available after
DatabaseStructure.registerExportables(Database)
has been called.- Specified by:
getPhysicalName
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
-
getAllSqlForTests
public String[] getAllSqlForTests()
- Specified by:
getAllSqlForTests
in interfaceDatabaseStructure
-
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.
-
configure
public void configure(Optimizer optimizer)
Description copied from interface:DatabaseStructure
Configures this structure with the given arguments.Called just after instantiation, before
DatabaseStructure.initialize(SqlStringGenerationContext)
- Specified by:
configure
in interfaceDatabaseStructure
- Parameters:
optimizer
- The optimizer being applied to the generator.
-
registerExportables
public void registerExportables(Database database)
Description copied from interface:DatabaseStructure
Register database objects involved in this structure, e.g. sequences, tables, etc.This method is called just once, after
DatabaseStructure.configure(Optimizer)
, but beforeDatabaseStructure.initialize(SqlStringGenerationContext)
.- Specified by:
registerExportables
in interfaceDatabaseStructure
- Specified by:
registerExportables
in interfaceExportableProducer
- Parameters:
database
- The database instance
-
initialize
public void initialize(SqlStringGenerationContext context)
Description copied from interface:DatabaseStructure
Initializes this structure, in particular pre-generates SQL as necessary.This method is called just once, after
DatabaseStructure.registerExportables(Database)
, before first use.- Specified by:
initialize
in interfaceDatabaseStructure
- Parameters:
context
- A context to help generate SQL strings
-
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)
-
-