TableGenerator
instead.@Deprecated public class MultipleHiLoPerTableGenerator extends Object implements PersistentIdentifierGenerator, Configurable
A hilo <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed using a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction to the <tt>Session</tt> transaction so the generator must be able to obtain a new connection and commit it. Hence this implementation may not be used when the user is supplying connections. In this case a <tt>SequenceHiLoGenerator</tt> would be a better choice (where supported).<br> <br> <p/> A hilo <tt>IdentifierGenerator</tt> that uses a database table to store the last generated values. A table can contains several hi values. They are distinct from each other through a key <p/> <p>This implementation is not compliant with a user connection</p> <p/> <p/> <p>Allowed parameters (all of them are optional):</p> <ul> <li>table: table name (default <tt>hibernate_sequences</tt>)</li> <li>primary_key_column: key column name (default <tt>sequence_name</tt>)</li> <li>value_column: hi value column name(default <tt>sequence_next_hi_value</tt>)</li> <li>primary_key_value: key value for the current entity (default to the entity’s primary table name)</li> <li>primary_key_length: length of the key column in DB represented as a varchar (default to 255)</li> <li>max_lo: max low value before increasing hi (default to Short.MAX_VALUE)</li> </ul>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TABLE
Deprecated.
|
static String |
ID_TABLE
Deprecated.
|
static String |
MAX_LO
Deprecated.
|
static String |
PK_COLUMN_NAME
Deprecated.
|
static String |
PK_LENGTH_NAME
Deprecated.
|
static String |
PK_VALUE_NAME
Deprecated.
|
static String |
VALUE_COLUMN_NAME
Deprecated.
|
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, TABLE, TABLES
ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
Constructor and Description |
---|
MultipleHiLoPerTableGenerator()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Type type,
Properties params,
ServiceRegistry serviceRegistry)
Deprecated.
Configure this instance, given the value of parameters
specified by the user as <tt><param></tt> elements.
|
protected QualifiedName |
determineGeneratorTableName(Properties params,
JdbcEnvironment jdbcEnvironment)
Deprecated.
|
protected String |
determineSegmentColumnName(Properties params,
JdbcEnvironment jdbcEnvironment)
Deprecated.
|
protected String |
determineValueColumnName(Properties params,
JdbcEnvironment jdbcEnvironment)
Deprecated.
|
Serializable |
generate(SharedSessionContractImplementor session,
Object obj)
Deprecated.
Generate a new identifier.
|
Object |
generatorKey()
Deprecated.
Return a key unique to the underlying database objects.
|
void |
registerExportables(Database database)
Deprecated.
Register the contained exportable things to the
Database |
String[] |
sqlCreateStrings(Dialect dialect)
Deprecated.
The SQL required to create the underlying database objects.
|
String[] |
sqlDropStrings(Dialect dialect)
Deprecated.
The SQL required to remove the underlying database objects.
|
public static final String ID_TABLE
public static final String PK_COLUMN_NAME
public static final String PK_VALUE_NAME
public static final String VALUE_COLUMN_NAME
public static final String PK_LENGTH_NAME
public static final String DEFAULT_TABLE
public static final String MAX_LO
public Serializable generate(SharedSessionContractImplementor session, Object obj)
IdentifierGenerator
Generate a new identifier.
generate
in interface IdentifierGenerator
session
- The session from which the request originatesobj
- the entity or collection (idbag) for which the id is being generatedpublic void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException
Configurable
Configure this instance, given the value of parameters specified by the user as <tt><param></tt> elements. This method is called just once, following instantiation.
configure
in interface Configurable
type
- The id property type descriptorparams
- param values, keyed by parameter nameserviceRegistry
- Access to service that may be needed.MappingException
protected QualifiedName determineGeneratorTableName(Properties params, JdbcEnvironment jdbcEnvironment)
protected String determineSegmentColumnName(Properties params, JdbcEnvironment jdbcEnvironment)
protected String determineValueColumnName(Properties params, JdbcEnvironment jdbcEnvironment)
public void registerExportables(Database database)
ExportableProducer
Register the contained exportable things to the Database
registerExportables
in interface ExportableProducer
database
- The database instancepublic String[] sqlCreateStrings(Dialect dialect) throws HibernateException
PersistentIdentifierGenerator
The SQL required to create the underlying database objects.
sqlCreateStrings
in interface PersistentIdentifierGenerator
dialect
- The dialect against which to generate the create command(s)HibernateException
- problem creating the create command(s)public String[] sqlDropStrings(Dialect dialect) throws HibernateException
PersistentIdentifierGenerator
The SQL required to remove the underlying database objects.
sqlDropStrings
in interface PersistentIdentifierGenerator
dialect
- The dialect against which to generate the drop command(s)HibernateException
- problem creating the drop command(s)public Object generatorKey()
PersistentIdentifierGenerator
Return a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.
generatorKey
in interface PersistentIdentifierGenerator
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.