Package org.hibernate.reactive.id.impl
Class TableReactiveIdentifierGenerator
java.lang.Object
org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
org.hibernate.reactive.id.impl.TableReactiveIdentifierGenerator
- 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.IdentifierGenerator,ReactiveIdentifierGenerator<Long>
- Direct Known Subclasses:
EmulatedSequenceReactiveIdentifierGenerator
public class TableReactiveIdentifierGenerator
extends BlockingIdentifierGenerator
implements org.hibernate.id.IdentifierGenerator
Support for JPA's
TableGenerator.
Persistence is managed via a table which may hold multiple
rows distinguished by a "segment" column value.
This implementation supports block allocation, but does not guarantee that generated identifiers are sequential.
- See Also:
-
Field Summary
FieldsFields inherited from interface org.hibernate.id.IdentifierGenerator
CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME -
Constructor Summary
ConstructorsConstructorDescriptionTableReactiveIdentifierGenerator(org.hibernate.id.enhanced.TableGenerator generator, org.hibernate.metamodel.spi.RuntimeModelCreationContext runtimeModelCreationContext) TableReactiveIdentifierGenerator(org.hibernate.id.enhanced.TableStructure structure, org.hibernate.metamodel.spi.RuntimeModelCreationContext runtimeModelCreationContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildInsertQuery(org.hibernate.dialect.Dialect dialect) protected StringbuildSelectQuery(org.hibernate.dialect.Dialect dialect) protected StringbuildUpdateQuery(org.hibernate.dialect.Dialect dialect) voidconfigure(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) protected Stringprotected intdetermineIncrement(Properties params) protected intdetermineInitialValue(Properties params) protected StringdetermineSegmentColumnName(Properties params, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment) protected StringdetermineSegmentValue(Properties params) protected BooleandetermineStoreLastUsedValue(org.hibernate.service.ServiceRegistry serviceRegistry) protected StringdetermineTableName(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) protected StringdetermineValueColumnNameForTable(Properties params, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment) protected intThe block size (the number of "lo" values for each "hi" value)protected Object[]insertParameters(long insertedValue) protected CompletionStage<Long>nextHiValue(ReactiveConnectionSupplier session) Allocate a new block, by obtaining the next "hi" value from the databaseprotected Object[]protected Object[]updateParameters(long currentValue, long updatedValue) Methods inherited from class org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
generateMethods 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.id.Configurable
configure, initializeMethods inherited from interface org.hibernate.generator.Generator
allowAssignedIdentifiers, allowMutation, generatedBeforeExecution, generatedOnExecution, generatesOnForceIncrement, generatesOnInsert, generatesOnUpdate, generatesSometimesMethods inherited from interface org.hibernate.id.IdentifierGenerator
generate, getEventTypes, registerExportablesMethods inherited from interface org.hibernate.reactive.id.ReactiveIdentifierGenerator
generate
-
Field Details
-
renderedTableName
-
segmentColumnName
-
valueColumnName
-
-
Constructor Details
-
TableReactiveIdentifierGenerator
public TableReactiveIdentifierGenerator(org.hibernate.id.enhanced.TableGenerator generator, org.hibernate.metamodel.spi.RuntimeModelCreationContext runtimeModelCreationContext) -
TableReactiveIdentifierGenerator
public TableReactiveIdentifierGenerator(org.hibernate.id.enhanced.TableStructure structure, org.hibernate.metamodel.spi.RuntimeModelCreationContext runtimeModelCreationContext)
-
-
Method Details
-
configure
public void configure(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) - Specified by:
configurein interfaceorg.hibernate.id.Configurable- Specified by:
configurein interfaceorg.hibernate.id.IdentifierGenerator
-
getBlockSize
protected int getBlockSize()Description copied from class:BlockingIdentifierGeneratorThe block size (the number of "lo" values for each "hi" value)- Specified by:
getBlockSizein classBlockingIdentifierGenerator
-
nextHiValue
Description copied from class:BlockingIdentifierGeneratorAllocate a new block, by obtaining the next "hi" value from the database- Specified by:
nextHiValuein classBlockingIdentifierGenerator
-
determineStoreLastUsedValue
protected Boolean determineStoreLastUsedValue(org.hibernate.service.ServiceRegistry serviceRegistry) -
determineTableName
protected String determineTableName(org.hibernate.type.Type type, Properties params, org.hibernate.service.ServiceRegistry serviceRegistry) -
determineSegmentColumnName
protected String determineSegmentColumnName(Properties params, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment) -
determineValueColumnNameForTable
protected String determineValueColumnNameForTable(Properties params, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment) -
determineSegmentValue
-
determineDefaultSegmentValue
-
determineInitialValue
-
determineIncrement
-
updateParameters
-
insertParameters
-
selectParameters
-
buildSelectQuery
-
buildUpdateQuery
-
buildInsertQuery
-