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:
-
AcrossSequencesInstaller
SettableIdBasedEntity
- Serialized Form
-
Field Summary
Fields 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_PARAM
Fields inherited from interface org.hibernate.id.IdentifierGenerator
CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
Fields inherited from interface org.hibernate.id.OptimizableGenerator
DEFAULT_INCREMENT_SIZE, DEFAULT_INITIAL_VALUE, IMPLICIT_NAME_BASE, INCREMENT_PARAM, INITIAL_PARAM, OPT_PARAM
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, TABLE, TABLES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(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, registerExportables
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.generator.BeforeExecutionGenerator
generatedOnExecution
Methods inherited from interface org.hibernate.generator.Generator
generatedOnExecution, generatesOnInsert, generatesOnUpdate, generatesSometimes
Methods 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:
configure
in interfaceorg.hibernate.id.Configurable
- Specified by:
configure
in interfaceorg.hibernate.id.IdentifierGenerator
- Overrides:
configure
in classorg.hibernate.id.enhanced.TableGenerator
- Throws:
org.hibernate.MappingException
-