Package org.hibernate.reactive.id.impl
Class ReactiveSequenceIdentifierGenerator
- java.lang.Object
-
- org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
-
- org.hibernate.reactive.id.impl.ReactiveSequenceIdentifierGenerator
-
- All Implemented Interfaces:
java.io.Serializable
,org.hibernate.boot.model.relational.ExportableProducer
,org.hibernate.generator.BeforeExecutionGenerator
,org.hibernate.generator.Generator
,org.hibernate.id.Configurable
,org.hibernate.id.IdentifierGenerator
,ReactiveIdentifierGenerator<java.lang.Long>
public class ReactiveSequenceIdentifierGenerator extends BlockingIdentifierGenerator implements org.hibernate.id.IdentifierGenerator
Support for JPA'sSequenceGenerator
.This implementation supports block allocation, but does not guarantee that generated identifiers are sequential.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object[]
NO_PARAMS
-
Constructor Summary
Constructors Constructor Description ReactiveSequenceIdentifierGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(org.hibernate.type.Type type, java.util.Properties properties, org.hibernate.service.ServiceRegistry serviceRegistry)
protected int
determineIncrementForSequenceEmulation(java.util.Properties params)
protected org.hibernate.boot.model.relational.QualifiedName
determineSequenceName(java.util.Properties params, org.hibernate.dialect.Dialect dialect, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnv, org.hibernate.service.ServiceRegistry serviceRegistry)
Determine the name of the sequence (or table if this resolves to a physical table) to use.java.lang.Object
generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, java.lang.Object object)
protected int
getBlockSize()
The block size (the number of "lo" values for each "hi" value)org.hibernate.boot.model.relational.QualifiedName
getSequenceName()
void
initialize(org.hibernate.boot.model.relational.SqlStringGenerationContext context)
protected java.util.concurrent.CompletionStage<java.lang.Long>
nextHiValue(ReactiveConnectionSupplier session)
Allocate a new block, by obtaining the next "hi" value from the database-
Methods inherited from class org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
generate
-
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
-
-
-
-
Method Detail
-
getBlockSize
protected int getBlockSize()
Description copied from class:BlockingIdentifierGenerator
The block size (the number of "lo" values for each "hi" value)- Specified by:
getBlockSize
in classBlockingIdentifierGenerator
-
nextHiValue
protected java.util.concurrent.CompletionStage<java.lang.Long> nextHiValue(ReactiveConnectionSupplier session)
Description copied from class:BlockingIdentifierGenerator
Allocate a new block, by obtaining the next "hi" value from the database- Specified by:
nextHiValue
in classBlockingIdentifierGenerator
-
configure
public void configure(org.hibernate.type.Type type, java.util.Properties properties, org.hibernate.service.ServiceRegistry serviceRegistry)
- Specified by:
configure
in interfaceorg.hibernate.id.Configurable
- Specified by:
configure
in interfaceorg.hibernate.id.IdentifierGenerator
-
determineSequenceName
protected org.hibernate.boot.model.relational.QualifiedName determineSequenceName(java.util.Properties params, org.hibernate.dialect.Dialect dialect, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnv, org.hibernate.service.ServiceRegistry serviceRegistry)
Determine the name of the sequence (or table if this resolves to a physical table) to use.Called during configuration.
- Parameters:
params
- The params supplied in the generator config (plus some standard useful extras).dialect
- The dialect in effectjdbcEnv
- The JdbcEnvironment- Returns:
- The sequence name
- See Also:
SequenceStyleGenerator.determineSequenceName(Properties, Dialect, JdbcEnvironment, ServiceRegistry)
-
initialize
public void initialize(org.hibernate.boot.model.relational.SqlStringGenerationContext context)
- Specified by:
initialize
in interfaceorg.hibernate.id.IdentifierGenerator
-
generate
public java.lang.Object generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, java.lang.Object object) throws org.hibernate.HibernateException
- Specified by:
generate
in interfaceorg.hibernate.id.IdentifierGenerator
- Throws:
org.hibernate.HibernateException
-
getSequenceName
public org.hibernate.boot.model.relational.QualifiedName getSequenceName()
-
determineIncrementForSequenceEmulation
protected int determineIncrementForSequenceEmulation(java.util.Properties params)
-
-