java.lang.Object | |
↳ | org.hibernate.id.enhanced.SequenceStyleGenerator |
Generates identifier values based on an sequence-style database structure.
Variations range from actually using a sequence to using a table to mimic
a sequence. These variations are encapsulated by the DatabaseStructure
interface internally.
NAME | DEFAULT | DESCRIPTION |
SEQUENCE_PARAM |
DEF_SEQUENCE_NAME |
The name of the sequence/table to use to store/retrieve values |
INITIAL_PARAM |
DEFAULT_INITIAL_VALUE |
The initial value to be stored for the given segment; the effect in terms of storage varies based on Optimizer and DatabaseStructure |
INCREMENT_PARAM |
DEFAULT_INCREMENT_SIZE |
The increment size for the underlying segment; the effect in terms of storage varies based on Optimizer and DatabaseStructure |
OPT_PARAM |
depends on defined increment size | Allows explicit definition of which optimization strategy to use | FORCE_TBL_PARAM |
false | Allows explicit definition of which optimization strategy to use |
NAME | DEFAULT | DESCRIPTION |
VALUE_COLUMN_PARAM |
DEF_VALUE_COLUMN |
The name of column which holds the sequence value for the given segment |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.hibernate.id.IdentifierGenerator
| |||||||||||
From interface
org.hibernate.id.PersistentIdentifierGenerator
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.hibernate.id.PersistentIdentifierGenerator
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Configure this instance, given the value of parameters
specified by the user as <param> elements.
| |||||||||||
Generate a new identifier.
| |||||||||||
Return a key unique to the underlying database objects.
| |||||||||||
Getter for property 'databaseStructure'.
| |||||||||||
Getter for property 'identifierType'.
| |||||||||||
Getter for property 'optimizer'.
| |||||||||||
The SQL required to create the underlying database objects.
| |||||||||||
The SQL required to remove the underlying database objects.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Build the database structure.
| |||||||||||
In certain cases we need to adjust the increment size based on the
selected optimizer.
| |||||||||||
Determine the increment size to be applied.
| |||||||||||
Determine the initial sequence value to use.
| |||||||||||
Determine the optimizer to use.
| |||||||||||
Determine the name of the sequence (or table if this resolves to a physical table)
to use.
| |||||||||||
Determine the name of the column used to store the generator value in
the db.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.hibernate.id.Configurable
| |||||||||||
From interface
org.hibernate.id.IdentifierGenerator
| |||||||||||
From interface
org.hibernate.id.PersistentIdentifierGenerator
|
Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.
params | param values, keyed by parameter name |
---|
MappingException |
---|
Generate a new identifier.
object | the entity or toplevel collection for which the id is being generated |
---|
HibernateException |
---|
Return a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.
Getter for property 'databaseStructure'.
Getter for property 'identifierType'.
Getter for property 'optimizer'.
The SQL required to create the underlying database objects.
dialect | The dialect against which to generate the create command(s) |
---|
HibernateException |
---|
The SQL required to remove the underlying database objects.
dialect | The dialect against which to generate the drop command(s) |
---|
HibernateException |
---|
Build the database structure.
type | The Hibernate type of the identifier property |
---|---|
params | The params supplied in the generator config (plus some standard useful extras). |
dialect | The dialect being used. |
forceTableUse | Should a table be used even if the dialect supports sequences? |
sequenceName | The name to use for the sequence or table. |
initialValue | The initial value. |
incrementSize | the increment size to use (after any adjustments). |
In certain cases we need to adjust the increment size based on the selected optimizer. This is the hook to achieve that.
optimizationStrategy | The optimizer strategy (name) |
---|---|
incrementSize | The determined increment size |
Determine the increment size to be applied. The exact implications of
this value depends on the optimizer
being used.
configuration
.params | The params supplied in the generator config (plus some standard useful extras). |
---|
Determine the initial sequence value to use. This value is used when
initializing the database structure
(i.e. sequence/table).
configuration
.params | The params supplied in the generator config (plus some standard useful extras). |
---|
Determine the optimizer to use.
Called duringconfiguration
.params | The params supplied in the generator config (plus some standard useful extras). |
---|---|
incrementSize | The determined increment size |
Determine the name of the sequence (or table if this resolves to a physical table) to use.
Called duringconfiguration
.params | The params supplied in the generator config (plus some standard useful extras). |
---|---|
dialect | The dialect in effect |
Determine the name of the column used to store the generator value in the db.
Called duringconfiguration
when resolving to a
physical table.params | The params supplied in the generator config (plus some standard useful extras). |
---|---|
dialect | The dialect in effect. |