DatabaseStructure
interface internally.
| Parameter name | Default value | Interpretation |
| sequence_name | The name of the sequence/table to use to store/retrieve values | |
| initial_value | 1 | The initial value to be stored for the given segment;
the effect in terms of storage varies based on Optimizer
and DatabaseStructure |
| increment_size | 50 | The increment size for the underlying segment;
the effect in terms of storage varies based on Optimizer
and DatabaseStructure |
| optimizer | depends on defined increment size | Allows explicit definition of which optimization strategy to use |
| force_table_use | false |
Allows explicit definition of which optimization strategy to use |
Configuration parameters used specifically when the underlying structure is a table:
| Parameter name | Default value | Interpretation |
| value_column | next_val | The name of column which holds the sequence value for the given segment |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | CONFIG_SEQUENCE_PER_ENTITY_SUFFIX
Specifies the suffix to use for an implicit sequence name - appended to the entity-name / collection-role |
| private DatabaseStructure | |
| public static final String | DEF_SEQUENCE_SUFFIX
The default value for |
| public static final String | DEF_VALUE_COLUMN
The default value for |
| public static final String | FORCE_TBL_PARAM
A flag to force using a table as the underlying structure rather than a sequence. |
| private Type | |
| private static final CoreMessageLogger | |
| private Optimizer | |
| public static final String | SEQUENCE_PARAM
Indicates the name of the sequence (or table) to use. |
| public static final String | VALUE_COLUMN_PARAM
Indicates the name of the column holding the identifier values. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int | adjustIncrementSize(JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int incrementSize, boolean physicalSequence, OptimizerDescriptor optimizationStrategy, ServiceRegistry serviceRegistry)
|
| protected DatabaseStructure | Returns: An abstraction for the actual database structure in use (table vs. sequence).The Hibernate type of the identifier property type, Properties The params supplied in the generator config (plus some standard useful extras). params, JdbcEnvironment The JDBC environment in which the sequence will be used. jdbcEnvironment, boolean Should a table be used even if the dialect supports sequences? forceTableUse, QualifiedName The name to use for the sequence or table. sequenceName, int The initial value. initialValue, int the increment size to use (after any adjustments). incrementSize)Build the database structure. |
| protected DatabaseStructure | buildSequenceStructure(Type type, Properties params, JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int initialValue, int incrementSize)
|
| protected DatabaseStructure | buildTableStructure(Type type, Properties params, JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int initialValue, int incrementSize)
|
| public void | configure(Type
The id property type descriptor type, Properties param values, keyed by parameter name parameters, ServiceRegistry Access to service that may be needed. serviceRegistry)Overrides default org. <param> elements.
|
| protected int | Returns: The adjusted increment size.The optimizer strategy (name) optimizationStrategy, int incrementSize)In certain cases we need to adjust the increment size based on the selected optimizer. |
| public String | determineBulkInsertionIdentifierGenerationSelectFragment(SqlStringGenerationContext context)
Overrides default org. |
| private String | |
| private QualifiedName | determineImplicitName(Identifier catalog, Identifier schema, Properties params, ServiceRegistry serviceRegistry)
|
| protected int | Returns: The increment sizeThe params supplied in the generator config (plus some standard useful extras). params)Determine the increment size to be applied. |
| protected int | Returns: The initial valueThe params supplied in the generator config (plus some standard useful extras). params)Determine the initial sequence value to use. |
| protected OptimizerDescriptor | Returns: The optimizer strategy (name)The params supplied in the generator config (plus some standard useful extras). params, int incrementSize)Determine the optimizer to use. |
| protected QualifiedName | Returns: The sequence nameThe params supplied in the generator config (plus some standard useful extras). params, Dialect The dialect in effect dialect, JdbcEnvironment The JdbcEnvironment jdbcEnv, ServiceRegistry serviceRegistry)Determine the name of the sequence (or table if this resolves to a physical table) to use. |
| protected Identifier | Returns: The value column nameThe params supplied in the generator config (plus some standard useful extras). params, JdbcEnvironment The JDBC environment jdbcEnvironment)Determine the name of the column used to store the generator value in the db. |
| public Object | generate(SharedSessionContractImplementor
The session from which the request originates session, Object the entity or collection (idbag) for which the id is being generated object)Implements org. |
| public DatabaseStructure | Returns: Value for property 'databaseStructure'.Getter for property 'databaseStructure'. |
| public Type | Returns: Value for property 'identifierType'.Getter for property 'identifierType'. |
| public Optimizer | Returns: Value for property 'optimizer'.Implements org. |
| private Number | Returns: sequence increment valuethe current JdbcEnvironment jdbcEnvironment, String sequence name sequenceName)Get the database sequence increment value from the associated |
| public void | initialize(SqlStringGenerationContext
A context to help generate SQL strings context)Overrides default org. |
| protected boolean | |
| public void | registerExportables(Database
The database instance database)Overrides default org. Implements org. |
| public boolean | supportsBulkInsertionIdentifierGeneration()
Overrides default org. |
| ALT_SEQUENCE_PARAM | back to summary |
|---|---|
| public static final String ALT_SEQUENCE_PARAM | |
| CONFIG_SEQUENCE_PER_ENTITY_SUFFIX | back to summary |
|---|---|
| public static final String CONFIG_SEQUENCE_PER_ENTITY_SUFFIX Specifies the suffix to use for an implicit sequence name - appended to the entity-name / collection-role | |
| databaseStructure | back to summary |
|---|---|
| private DatabaseStructure databaseStructure | |
| DEF_SEQUENCE_SUFFIX | back to summary |
|---|---|
| public static final String DEF_SEQUENCE_SUFFIX The default value for | |
| DEF_VALUE_COLUMN | back to summary |
|---|---|
| public static final String DEF_VALUE_COLUMN The default value for | |
| FORCE_TBL_PARAM | back to summary |
|---|---|
| public static final String FORCE_TBL_PARAM A flag to force using a table as the underlying structure rather than a sequence. | |
| identifierType | back to summary |
|---|---|
| private Type identifierType | |
| LOG | back to summary |
|---|---|
| private static final CoreMessageLogger LOG | |
| optimizer | back to summary |
|---|---|
| private Optimizer optimizer | |
| SEQUENCE_PARAM | back to summary |
|---|---|
| public static final String SEQUENCE_PARAM Indicates the name of the sequence (or table) to use. The implicit value is based on the entity / collection-role name | |
| VALUE_COLUMN_PARAM | back to summary |
|---|---|
| public static final String VALUE_COLUMN_PARAM Indicates the name of the column holding the identifier values. The default value is next_val | |
| SequenceStyleGenerator | back to summary |
|---|---|
| public SequenceStyleGenerator() | |
| adjustIncrementSize | back to summary |
|---|---|
| private int adjustIncrementSize(JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int incrementSize, boolean physicalSequence, OptimizerDescriptor optimizationStrategy, ServiceRegistry serviceRegistry) | |
| buildDatabaseStructure | back to summary |
|---|---|
| protected DatabaseStructure buildDatabaseStructure(Type type, Properties params, JdbcEnvironment jdbcEnvironment, boolean forceTableUse, QualifiedName sequenceName, int initialValue, int incrementSize) Build the database structure.
| |
| buildSequenceStructure | back to summary |
|---|---|
| protected DatabaseStructure buildSequenceStructure(Type type, Properties params, JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int initialValue, int incrementSize) | |
| buildTableStructure | back to summary |
|---|---|
| protected DatabaseStructure buildTableStructure(Type type, Properties params, JdbcEnvironment jdbcEnvironment, QualifiedName sequenceName, int initialValue, int incrementSize) | |
| configure | back to summary |
|---|---|
| public void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) throws MappingException Overrides default org. Doc from org. Configure this instance, given the value of parameters
specified by the user as
This method is called just once, following instantiation,
and before
| |
| determineAdjustedIncrementSize | back to summary |
|---|---|
| protected int determineAdjustedIncrementSize(OptimizerDescriptor optimizationStrategy, int incrementSize) In certain cases we need to adjust the increment size based on the selected optimizer. This is the hook to achieve that.
| |
| determineBulkInsertionIdentifierGenerationSelectFragment | back to summary |
|---|---|
| public String determineBulkInsertionIdentifierGenerationSelectFragment(SqlStringGenerationContext context) Overrides default org. Return the select expression fragment, if any, that generates the identifier values. | |
| determineContributor | back to summary |
|---|---|
| private String determineContributor(Properties params) | |
| determineImplicitName | back to summary |
|---|---|
| private QualifiedName determineImplicitName(Identifier catalog, Identifier schema, Properties params, ServiceRegistry serviceRegistry) | |
| determineIncrementSize | back to summary |
|---|---|
| protected int determineIncrementSize(Properties params) Determine the increment size to be applied. The exact implications of this value depends on the optimizer being used. Called during configuration.
| |
| determineInitialValue | back to summary |
|---|---|
| protected int determineInitialValue(Properties params) Determine the initial sequence value to use. This value is used when
initializing the Called during configuration.
| |
| determineOptimizationStrategy | back to summary |
|---|---|
| protected OptimizerDescriptor determineOptimizationStrategy(Properties params, int incrementSize) Determine the optimizer to use. Called during configuration.
| |
| determineSequenceName | back to summary |
|---|---|
| protected QualifiedName determineSequenceName(Properties params, Dialect dialect, JdbcEnvironment jdbcEnv, ServiceRegistry serviceRegistry) Determine the name of the sequence (or table if this resolves to a physical table) to use. Called during configuration.
| |
| determineValueColumnName | back to summary |
|---|---|
| protected Identifier determineValueColumnName(Properties params, JdbcEnvironment jdbcEnvironment) Determine the name of the column used to store the generator value in the db. Called during configuration when resolving to a physical table.
| |
| generate | back to summary |
|---|---|
| public Object generate(SharedSessionContractImplementor session, Object object) throws HibernateException Implements org. Doc from org. Generate a new identifier.
| |
| getDatabaseStructure | back to summary |
|---|---|
| public DatabaseStructure getDatabaseStructure() Getter for property 'databaseStructure'.
| |
| getIdentifierType | back to summary |
|---|---|
| public Type getIdentifierType() Getter for property 'identifierType'.
| |
| getOptimizer | back to summary |
|---|---|
| public Optimizer getOptimizer() Implements org. Getter for property 'optimizer'. | |
| getSequenceIncrementValue | back to summary |
|---|---|
| private Number getSequenceIncrementValue(JdbcEnvironment jdbcEnvironment, String sequenceName) Get the database sequence increment value from the associated
| |
| initialize | back to summary |
|---|---|
| public void initialize(SqlStringGenerationContext context) Overrides default org. Doc from org. Initializes this instance, in particular pre-generates SQL as necessary.
This method is called after
| |
| isPhysicalSequence | back to summary |
|---|---|
| protected boolean isPhysicalSequence(JdbcEnvironment jdbcEnvironment, boolean forceTableUse) | |
| registerExportables | back to summary |
|---|---|
| public void registerExportables(Database database) Overrides default org. Implements org. Doc from org. Register database objects used by this identifier generator, for example, a sequence or tables.
This method is called just once, after
| |
| supportsBulkInsertionIdentifierGeneration | back to summary |
|---|---|
| public boolean supportsBulkInsertionIdentifierGeneration() Overrides default org. Doc from org. Given the configuration of this generator, is identifier generation as part of bulk insertion supported?
| |