DatabaseStructure
interface internally.
General configuration parameters:
| 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 |
Configuration parameters used specifically when the underlying structure is a table:
| NAME | DEFAULT | DESCRIPTION |
VALUE_COLUMN_PARAM |
DEF_VALUE_COLUMN |
The name of column which holds the sequence value for the given segment |
| Modifier and Type | Field and Description |
|---|---|
| private DatabaseStructure | |
| public static final String | |
| public static final String | |
| public static final int | |
| public static final int | |
| public static final String | |
| private Type | |
| public static final String | |
| public static final String | |
| private static final Logger | |
| public static final String | |
| private Optimizer | |
| public static final String | |
| public static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| 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, Dialect The dialect being used. dialect, boolean Should a table be used even if the dialect supports sequences? forceTableUse, String 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. |
| public void | configure(Type type, Properties
param values, keyed by parameter name params, Dialect dialect)Implements org. |
| 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. |
| 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 String | 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 String | Returns: The sequence nameThe params supplied in the generator config (plus some standard useful extras). params, Dialect The dialect in effect dialect)Determine the name of the sequence (or table if this resolves to a physical table) to use. |
| protected String | Returns: The value column nameThe params supplied in the generator config (plus some standard useful extras). params, Dialect The dialect in effect. dialect)Determine the name of the column used to store the generator value in the db. |
| public Serializable | generate(SessionImplementor session, Object
the entity or toplevel collection for which the id is being generated object)Implements org. |
| public Object | generatorKey()
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 | |
| public String[] | sqlCreateStrings(Dialect
The dialect against which to generate the create command(s) dialect)Implements org. |
| public String[] | sqlDropStrings(Dialect
The dialect against which to generate the drop command(s) dialect)Implements org. |
| databaseStructure | back to summary |
|---|---|
| private DatabaseStructure databaseStructure | |
| DEF_SEQUENCE_NAME | back to summary |
|---|---|
| public static final String DEF_SEQUENCE_NAME | |
| DEF_VALUE_COLUMN | back to summary |
|---|---|
| public static final String DEF_VALUE_COLUMN | |
| DEFAULT_INCREMENT_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_INCREMENT_SIZE | |
| DEFAULT_INITIAL_VALUE | back to summary |
|---|---|
| public static final int DEFAULT_INITIAL_VALUE | |
| FORCE_TBL_PARAM | back to summary |
|---|---|
| public static final String FORCE_TBL_PARAM | |
| identifierType | back to summary |
|---|---|
| private Type identifierType | |
| INCREMENT_PARAM | back to summary |
|---|---|
| public static final String INCREMENT_PARAM | |
| INITIAL_PARAM | back to summary |
|---|---|
| public static final String INITIAL_PARAM | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| OPT_PARAM | back to summary |
|---|---|
| public static final String OPT_PARAM | |
| optimizer | back to summary |
|---|---|
| private Optimizer optimizer | |
| SEQUENCE_PARAM | back to summary |
|---|---|
| public static final String SEQUENCE_PARAM | |
| VALUE_COLUMN_PARAM | back to summary |
|---|---|
| public static final String VALUE_COLUMN_PARAM | |
| SequenceStyleGenerator | back to summary |
|---|---|
| public SequenceStyleGenerator() | |
| buildDatabaseStructure | back to summary |
|---|---|
| protected DatabaseStructure buildDatabaseStructure(Type type, Properties params, Dialect dialect, boolean forceTableUse, String sequenceName, int initialValue, int incrementSize) Build the database structure.
| |
| configure | back to summary |
|---|---|
| public void configure(Type type, Properties params, Dialect dialect) throws MappingException Implements org. Doc from org. Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.
| |
| determineAdjustedIncrementSize | back to summary |
|---|---|
| protected int determineAdjustedIncrementSize(String 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.
| |
| 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
Called during
| |
| 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
| |
| determineOptimizationStrategy | back to summary |
|---|---|
| protected String determineOptimizationStrategy(Properties params, int incrementSize) Determine the optimizer to use.
Called during
| |
| determineSequenceName | back to summary |
|---|---|
| protected String determineSequenceName(Properties params, Dialect dialect) Determine the name of the sequence (or table if this resolves to a physical table) to use.
Called during
| |
| determineValueColumnName | back to summary |
|---|---|
| protected String determineValueColumnName(Properties params, Dialect dialect) Determine the name of the column used to store the generator value in the db.
Called during
| |
| generate | back to summary |
|---|---|
| public Serializable generate(SessionImplementor session, Object object) throws HibernateException Implements org. Doc from org. Generate a new identifier.
| |
| generatorKey | back to summary |
|---|---|
| public Object generatorKey() Implements org. Doc from org. Return a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.
| |
| 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() Getter for property 'optimizer'.
| |
| sqlCreateStrings | back to summary |
|---|---|
| public String[] sqlCreateStrings(Dialect dialect) throws HibernateException Implements org. Doc from org. The SQL required to create the underlying database objects.
| |
| sqlDropStrings | back to summary |
|---|---|
| public String[] sqlDropStrings(Dialect dialect) throws HibernateException Implements org. Doc from org. The SQL required to remove the underlying database objects.
| |