Package org.hibernate.id
Class MultipleHiLoPerTableGenerator
- java.lang.Object
-
- org.hibernate.id.MultipleHiLoPerTableGenerator
-
- All Implemented Interfaces:
ExportableProducer,Configurable,IdentifierGenerator,PersistentIdentifierGenerator
@Deprecated public class MultipleHiLoPerTableGenerator extends java.lang.Object implements PersistentIdentifierGenerator
Deprecated.UseTableGeneratorinstead.A hilo IdentifierGenerator that returns a Long, constructed using a hi/lo algorithm. The hi value MUST be fetched in a separate transaction to the Session 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 SequenceHiLoGenerator would be a better choice (where supported).
A hilo IdentifierGenerator 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 keyThis implementation is not compliant with a user connection
Allowed parameters (all of them are optional):
- table: table name (default hibernate_sequences)
- primary_key_column: key column name (default sequence_name)
- value_column: hi value column name(default sequence_next_hi_value)
- primary_key_value: key value for the current entity (default to the entity's primary table name)
- primary_key_length: length of the key column in DB represented as a varchar (default to 255)
- max_lo: max low value before increasing hi (default to Short.MAX_VALUE)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_TABLEDeprecated.static java.lang.StringID_TABLEDeprecated.static java.lang.StringMAX_LODeprecated.static java.lang.StringPK_COLUMN_NAMEDeprecated.static java.lang.StringPK_LENGTH_NAMEDeprecated.static java.lang.StringPK_VALUE_NAMEDeprecated.static java.lang.StringVALUE_COLUMN_NAMEDeprecated.-
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
-
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, TABLE, TABLES
-
-
Constructor Summary
Constructors Constructor Description MultipleHiLoPerTableGenerator()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidconfigure(Type type, java.util.Properties params, ServiceRegistry serviceRegistry)Deprecated.Configure this instance, given the value of parameters specified by the user as <param> elements.protected QualifiedNamedetermineGeneratorTableName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)Deprecated.protected java.lang.StringdetermineSegmentColumnName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)Deprecated.protected java.lang.StringdetermineValueColumnName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)Deprecated.java.io.Serializablegenerate(SharedSessionContractImplementor session, java.lang.Object obj)Deprecated.Generate a new identifier.java.lang.ObjectgeneratorKey()Deprecated.voidinitialize(SqlStringGenerationContext context)Deprecated.Initializes this instance, in particular pre-generates SQL as necessary.voidregisterExportables(Database database)Deprecated.Register database objects used by this identifier generator, e.g.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.id.IdentifierGenerator
supportsJdbcBatchInserts
-
-
-
-
Field Detail
-
ID_TABLE
public static final java.lang.String ID_TABLE
Deprecated.- See Also:
- Constant Field Values
-
PK_COLUMN_NAME
public static final java.lang.String PK_COLUMN_NAME
Deprecated.- See Also:
- Constant Field Values
-
PK_VALUE_NAME
public static final java.lang.String PK_VALUE_NAME
Deprecated.- See Also:
- Constant Field Values
-
VALUE_COLUMN_NAME
public static final java.lang.String VALUE_COLUMN_NAME
Deprecated.- See Also:
- Constant Field Values
-
PK_LENGTH_NAME
public static final java.lang.String PK_LENGTH_NAME
Deprecated.- See Also:
- Constant Field Values
-
DEFAULT_TABLE
public static final java.lang.String DEFAULT_TABLE
Deprecated.- See Also:
- Constant Field Values
-
MAX_LO
public static final java.lang.String MAX_LO
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
generate
public java.io.Serializable generate(SharedSessionContractImplementor session, java.lang.Object obj)
Deprecated.Description copied from interface:IdentifierGeneratorGenerate a new identifier.- Specified by:
generatein interfaceIdentifierGenerator- Parameters:
session- The session from which the request originatesobj- the entity or collection (idbag) for which the id is being generated- Returns:
- a new identifier
-
configure
public void configure(Type type, java.util.Properties params, ServiceRegistry serviceRegistry) throws MappingException
Deprecated.Description copied from interface:IdentifierGeneratorConfigure this instance, given the value of parameters specified by the user as <param> elements.This method is called just once, following instantiation, and before
IdentifierGenerator.registerExportables(Database).- Specified by:
configurein interfaceConfigurable- Specified by:
configurein interfaceIdentifierGenerator- Parameters:
type- The id property type descriptorparams- param values, keyed by parameter nameserviceRegistry- Access to service that may be needed.- Throws:
MappingException- If configuration fails.
-
determineGeneratorTableName
protected QualifiedName determineGeneratorTableName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)
Deprecated.
-
determineSegmentColumnName
protected java.lang.String determineSegmentColumnName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)Deprecated.
-
determineValueColumnName
protected java.lang.String determineValueColumnName(java.util.Properties params, JdbcEnvironment jdbcEnvironment)Deprecated.
-
registerExportables
public void registerExportables(Database database)
Deprecated.Description copied from interface:IdentifierGeneratorRegister database objects used by this identifier generator, e.g. sequences, tables, etc.This method is called just once, after
IdentifierGenerator.configure(Type, Properties, ServiceRegistry).- Specified by:
registerExportablesin interfaceExportableProducer- Specified by:
registerExportablesin interfaceIdentifierGenerator- Parameters:
database- The database instance
-
initialize
public void initialize(SqlStringGenerationContext context)
Deprecated.Description copied from interface:IdentifierGeneratorInitializes this instance, in particular pre-generates SQL as necessary.This method is called after
IdentifierGenerator.registerExportables(Database), before first use.- Specified by:
initializein interfaceIdentifierGenerator- Parameters:
context- A context to help generate SQL strings
-
generatorKey
@Deprecated public java.lang.Object generatorKey()
Deprecated.Description copied from interface:PersistentIdentifierGeneratorReturn a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.- Specified by:
generatorKeyin interfacePersistentIdentifierGenerator- Returns:
- Object an identifying key for this generator
-
-