Class AcrossSequenceGenerator
java.lang.Object
org.hibernate.id.enhanced.TableGenerator
com.foreach.across.modules.hibernate.id.AcrossSequenceGenerator
- All Implemented Interfaces:
Serializable,org.hibernate.boot.model.relational.ExportableProducer,org.hibernate.generator.BeforeExecutionGenerator,org.hibernate.generator.Generator,org.hibernate.id.Configurable,org.hibernate.id.factory.spi.StandardGenerator,org.hibernate.id.IdentifierGenerator,org.hibernate.id.OptimizableGenerator,org.hibernate.id.PersistentIdentifierGenerator
public class AcrossSequenceGenerator
extends org.hibernate.id.enhanced.TableGenerator
Custom TableGenerator strategy for generating long ids.
Has support for manually defining an id value and inserting an entity with that value instead.
Note that the repository code should support this behavior correctly, and special care should be
taken to avoid manual ids interfering with the sequence values.
@GeneratedValue(generator = "seq_um_user_id")
@GenericGenerator(
name = "seq_um_user_id",
strategy = "com.foreach.across.modules.hibernate.id.AcrossSequenceGenerator",
parameters = {
@Parameter(name = "sequenceName", value = "seq_um_user_id"),
@Parameter(name = "allocationSize", value = "10")
}
)
The following parameters can be configured:
- sequenceName: mandatory, name of the sequence in the sequences table
- allowPredefinedIds: true if the generator should support manually inserting ids (default: true)
- allocationSize: sequence allocation size (default: 50)
- initialValue: initial sequence value (default: 1)
- See Also:
-
AcrossSequencesInstallerSettableIdBasedEntity- Serialized Form
-
Field Summary
FieldsFields inherited from class org.hibernate.id.enhanced.TableGenerator
CONFIG_PREFER_SEGMENT_PER_ENTITY, DEF_SEGMENT_COLUMN, DEF_SEGMENT_LENGTH, DEF_SEGMENT_VALUE, DEF_TABLE, DEF_VALUE_COLUMN, SEGMENT_COLUMN_PARAM, SEGMENT_LENGTH_PARAM, SEGMENT_VALUE_PARAM, TABLE_PARAM, VALUE_COLUMN_PARAMFields inherited from interface org.hibernate.id.IdentifierGenerator
CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAMEFields inherited from interface org.hibernate.id.OptimizableGenerator
DEFAULT_INCREMENT_SIZE, DEFAULT_INITIAL_VALUE, IMPLICIT_NAME_BASE, INCREMENT_PARAM, INITIAL_PARAM, OPT_PARAMFields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, TABLE, TABLES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) Methods inherited from class org.hibernate.id.enhanced.TableGenerator
buildInsertQuery, buildSelectQuery, buildUpdateQuery, determineDefaultSegmentValue, determineGeneratorTableName, determineIncrementSize, determineInitialValue, determineSegmentColumnName, determineSegmentColumnSize, determineSegmentValue, determineValueColumnName, generateInsertInitCommand, getAllSqlForTests, getIdentifierType, getIncrementSize, getInitialValue, getOptimizer, getSegmentColumnName, getSegmentValue, getSegmentValueLength, getTableAccessCount, getTableName, getValueColumnName, initialize, registerExportablesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.generator.BeforeExecutionGenerator
generatedOnExecutionMethods inherited from interface org.hibernate.generator.Generator
generatedOnExecution, generatesOnInsert, generatesOnUpdate, generatesSometimesMethods inherited from interface org.hibernate.id.IdentifierGenerator
generate, getEventTypes, supportsJdbcBatchInserts
-
Field Details
-
STRATEGY
- See Also:
-
-
Constructor Details
-
AcrossSequenceGenerator
public AcrossSequenceGenerator()
-
-
Method Details
-
configure
public void configure(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) throws org.hibernate.MappingException - Specified by:
configurein interfaceorg.hibernate.id.Configurable- Specified by:
configurein interfaceorg.hibernate.id.IdentifierGenerator- Overrides:
configurein classorg.hibernate.id.enhanced.TableGenerator- Throws:
org.hibernate.MappingException
-