public class ModifiedTableGenerator
extends java.lang.Object
implements org.hibernate.id.PersistentIdentifierGenerator, org.hibernate.id.Configurable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONFIG_PREFER_SEGMENT_PER_ENTITY
By default (in the absence of a
SEGMENT_VALUE_PARAM setting) we use a single row for all
generators. |
static java.lang.String |
DEF_SEGMENT_COLUMN
The default
SEGMENT_COLUMN_PARAM value |
static int |
DEF_SEGMENT_LENGTH
The default
SEGMENT_LENGTH_PARAM value |
static java.lang.String |
DEF_SEGMENT_VALUE
The default
SEGMENT_VALUE_PARAM value, unless CONFIG_PREFER_SEGMENT_PER_ENTITY is specified |
static java.lang.String |
DEF_TABLE
The default
TABLE_PARAM value |
static java.lang.String |
DEF_VALUE_COLUMN
The default
VALUE_COLUMN_PARAM value |
static int |
DEFAULT_INCREMENT_SIZE
The default
INCREMENT_PARAM value |
static int |
DEFAULT_INITIAL_VALUE
The default
INITIAL_PARAM value |
static java.lang.String |
INCREMENT_PARAM
Indicates the increment size to use.
|
static java.lang.String |
INITIAL_PARAM
Indicates the initial value to use.
|
static java.lang.String |
OPT_PARAM
Indicates the optimizer to use, either naming a
Optimizer implementation class or by naming
a StandardOptimizerDescriptor by name |
static java.lang.String |
SEGMENT_COLUMN_PARAM
The name of the column which holds the segment key.
|
static java.lang.String |
SEGMENT_LENGTH_PARAM
Indicates the length of the column defined by
SEGMENT_COLUMN_PARAM. |
static java.lang.String |
SEGMENT_VALUE_PARAM
The value indicating which segment is used by this generator, as indicated by the actual value stored in the
column indicated by
SEGMENT_COLUMN_PARAM. |
static java.lang.String |
TABLE_PARAM
Configures the name of the table to use.
|
static java.lang.String |
VALUE_COLUMN_PARAM
The name of column which holds the sequence value.
|
| Constructor and Description |
|---|
ModifiedTableGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
buildInsertQuery() |
protected java.lang.String |
buildSelectQuery(org.hibernate.dialect.Dialect dialect) |
protected java.lang.String |
buildUpdateQuery() |
void |
configure(org.hibernate.type.Type type,
java.util.Properties params,
org.hibernate.service.ServiceRegistry serviceRegistry) |
protected java.lang.String |
determineDefaultSegmentValue(java.util.Properties params)
Used in the cases where
determineSegmentValue(java.util.Properties) is unable to
determine the value to use. |
protected org.hibernate.boot.model.relational.QualifiedName |
determineGeneratorTableName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
Determine the table name to use for the generator values.
|
protected int |
determineIncrementSize(java.util.Properties params) |
protected long |
determineInitialValue(java.util.Properties params) |
protected java.lang.String |
determineSegmentColumnName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
Determine the name of the column used to indicate the segment for each
row.
|
protected int |
determineSegmentColumnSize(java.util.Properties params)
Determine the size of the
segment column
Called during configuration. |
protected java.lang.String |
determineSegmentValue(java.util.Properties params)
Determine the segment value corresponding to this generator instance.
|
protected java.lang.String |
determineValueColumnName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
Determine the name of the column in which we will store the generator persistent value.
|
java.io.Serializable |
generate(org.hibernate.engine.spi.SharedSessionContractImplementor session,
java.lang.Object obj) |
java.lang.Object |
generatorKey() |
org.hibernate.type.Type |
getIdentifierType()
Type mapping for the identifier.
|
int |
getIncrementSize()
The amount of increment to use.
|
long |
getInitialValue()
The initial value to use when we find no previous state in the
generator table corresponding to our sequence.
|
org.hibernate.id.enhanced.Optimizer |
getOptimizer()
The optimizer being used by this generator.
|
java.lang.String |
getSegmentColumnName()
The name of the column in which we store the segment to which each row
belongs.
|
java.lang.String |
getSegmentValue()
The value in
segment column which
corresponding to this generator instance. |
int |
getSegmentValueLength()
The size of the
segment column in the
underlying table. |
long |
getTableAccessCount()
Getter for property 'tableAccessCount'.
|
java.lang.String |
getTableName()
The name of the table in which we store this generator's persistent state.
|
java.lang.String |
getValueColumnName()
The name of the column in which we store our persistent generator value.
|
void |
registerExportables(org.hibernate.boot.model.relational.Database database) |
java.lang.String[] |
sqlCreateStrings(org.hibernate.dialect.Dialect dialect) |
java.lang.String[] |
sqlDropStrings(org.hibernate.dialect.Dialect dialect) |
public static final java.lang.String CONFIG_PREFER_SEGMENT_PER_ENTITY
SEGMENT_VALUE_PARAM setting) we use a single row for all
generators. This setting can be used to change that to instead default to using a row for each entity name.public static final java.lang.String TABLE_PARAM
DEF_TABLEpublic static final java.lang.String DEF_TABLE
TABLE_PARAM valuepublic static final java.lang.String VALUE_COLUMN_PARAM
DEF_VALUE_COLUMNpublic static final java.lang.String DEF_VALUE_COLUMN
VALUE_COLUMN_PARAM valuepublic static final java.lang.String SEGMENT_COLUMN_PARAM
DEF_SEGMENT_COLUMNpublic static final java.lang.String DEF_SEGMENT_COLUMN
SEGMENT_COLUMN_PARAM valuepublic static final java.lang.String SEGMENT_VALUE_PARAM
SEGMENT_COLUMN_PARAM. The default value for setting is DEF_SEGMENT_VALUE,
although CONFIG_PREFER_SEGMENT_PER_ENTITY effects the default as well.public static final java.lang.String DEF_SEGMENT_VALUE
SEGMENT_VALUE_PARAM value, unless CONFIG_PREFER_SEGMENT_PER_ENTITY is specifiedpublic static final java.lang.String SEGMENT_LENGTH_PARAM
SEGMENT_COLUMN_PARAM. Used in schema export. The
default value is DEF_SEGMENT_LENGTHpublic static final int DEF_SEGMENT_LENGTH
SEGMENT_LENGTH_PARAM valuepublic static final java.lang.String INITIAL_PARAM
DEFAULT_INITIAL_VALUEpublic static final int DEFAULT_INITIAL_VALUE
INITIAL_PARAM valuepublic static final java.lang.String INCREMENT_PARAM
DEFAULT_INCREMENT_SIZEpublic static final int DEFAULT_INCREMENT_SIZE
INCREMENT_PARAM valuepublic static final java.lang.String OPT_PARAM
Optimizer implementation class or by naming
a StandardOptimizerDescriptor by namepublic java.lang.Object generatorKey()
generatorKey in interface org.hibernate.id.PersistentIdentifierGeneratorpublic final org.hibernate.type.Type getIdentifierType()
public final java.lang.String getTableName()
public final java.lang.String getSegmentColumnName()
public final java.lang.String getSegmentValue()
segment column which
corresponding to this generator instance. In other words this value
indicates the row in which this generator instance will store values.public final int getSegmentValueLength()
segment column in the
underlying table.
NOTE : should really have been called 'segmentColumnLength' or
even better 'segmentColumnSize'public final java.lang.String getValueColumnName()
public final long getInitialValue()
public final int getIncrementSize()
optimizer being used.public final org.hibernate.id.enhanced.Optimizer getOptimizer()
public final long getTableAccessCount()
public void configure(org.hibernate.type.Type type,
java.util.Properties params,
org.hibernate.service.ServiceRegistry serviceRegistry)
throws org.hibernate.MappingException
configure in interface org.hibernate.id.Configurableorg.hibernate.MappingExceptionprotected org.hibernate.boot.model.relational.QualifiedName determineGeneratorTableName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
configuration.params - The params supplied in the generator config (plus some standard useful extras).jdbcEnvironment - The JDBC environmentgetTableName()protected java.lang.String determineSegmentColumnName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
configuration.params - The params supplied in the generator config (plus some standard useful extras).jdbcEnvironment - The JDBC environmentgetSegmentColumnName()protected java.lang.String determineValueColumnName(java.util.Properties params,
org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
configuration.params - The params supplied in the generator config (plus some standard useful extras).jdbcEnvironment - The JDBC environmentgetValueColumnName()protected java.lang.String determineSegmentValue(java.util.Properties params)
configuration.params - The params supplied in the generator config (plus some standard useful extras).getSegmentValue()protected java.lang.String determineDefaultSegmentValue(java.util.Properties params)
determineSegmentValue(java.util.Properties) is unable to
determine the value to use.params - The params supplied in the generator config (plus some standard useful extras).protected int determineSegmentColumnSize(java.util.Properties params)
segment column
Called during configuration.params - The params supplied in the generator config (plus some standard useful extras).getSegmentValueLength()protected long determineInitialValue(java.util.Properties params)
protected int determineIncrementSize(java.util.Properties params)
protected java.lang.String buildSelectQuery(org.hibernate.dialect.Dialect dialect)
protected java.lang.String buildUpdateQuery()
protected java.lang.String buildInsertQuery()
public java.io.Serializable generate(org.hibernate.engine.spi.SharedSessionContractImplementor session,
java.lang.Object obj)
generate in interface org.hibernate.id.IdentifierGeneratorpublic java.lang.String[] sqlCreateStrings(org.hibernate.dialect.Dialect dialect)
throws org.hibernate.HibernateException
sqlCreateStrings in interface org.hibernate.id.PersistentIdentifierGeneratororg.hibernate.HibernateExceptionpublic java.lang.String[] sqlDropStrings(org.hibernate.dialect.Dialect dialect)
throws org.hibernate.HibernateException
sqlDropStrings in interface org.hibernate.id.PersistentIdentifierGeneratororg.hibernate.HibernateExceptionpublic void registerExportables(org.hibernate.boot.model.relational.Database database)
registerExportables in interface org.hibernate.boot.model.relational.ExportableProducer