Class ReactiveSequenceIdentifierGenerator

java.lang.Object
org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
org.hibernate.reactive.id.impl.ReactiveSequenceIdentifierGenerator
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>

public class ReactiveSequenceIdentifierGenerator extends BlockingIdentifierGenerator implements org.hibernate.id.IdentifierGenerator
Support for JPA's SequenceGenerator.

This implementation supports block allocation, but does not guarantee that generated identifiers are sequential.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Object[]
     

    Fields inherited from interface org.hibernate.id.IdentifierGenerator

    CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ReactiveSequenceIdentifierGenerator(org.hibernate.id.enhanced.DatabaseStructure structure, org.hibernate.metamodel.spi.RuntimeModelCreationContext creationContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(org.hibernate.type.Type type, Properties properties, org.hibernate.service.ServiceRegistry serviceRegistry)
     
    protected int
     
    protected org.hibernate.boot.model.relational.QualifiedName
    determineSequenceName(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.
    generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object object)
     
    protected int
    The block size (the number of "lo" values for each "hi" value)
    org.hibernate.boot.model.relational.QualifiedName
     
    void
    initialize(org.hibernate.boot.model.relational.SqlStringGenerationContext context)
     
    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

    Methods inherited from interface org.hibernate.id.Configurable

    configure

    Methods inherited from interface org.hibernate.generator.Generator

    allowAssignedIdentifiers, allowMutation, generatedBeforeExecution, generatedOnExecution, generatesOnForceIncrement, generatesOnInsert, generatesOnUpdate, generatesSometimes

    Methods inherited from interface org.hibernate.id.IdentifierGenerator

    generate, getEventTypes, registerExportables

    Methods inherited from interface org.hibernate.reactive.id.ReactiveIdentifierGenerator

    generate
  • Field Details

    • NO_PARAMS

      public static final Object[] NO_PARAMS
  • Constructor Details

    • ReactiveSequenceIdentifierGenerator

      public ReactiveSequenceIdentifierGenerator()
    • ReactiveSequenceIdentifierGenerator

      public ReactiveSequenceIdentifierGenerator(org.hibernate.id.enhanced.DatabaseStructure structure, org.hibernate.metamodel.spi.RuntimeModelCreationContext creationContext)
  • Method Details

    • 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 class BlockingIdentifierGenerator
    • nextHiValue

      protected CompletionStage<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 class BlockingIdentifierGenerator
    • configure

      public void configure(org.hibernate.type.Type type, Properties properties, org.hibernate.service.ServiceRegistry serviceRegistry)
      Specified by:
      configure in interface org.hibernate.id.Configurable
      Specified by:
      configure in interface org.hibernate.id.IdentifierGenerator
    • determineSequenceName

      protected org.hibernate.boot.model.relational.QualifiedName determineSequenceName(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 effect
      jdbcEnv - 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 interface org.hibernate.id.Configurable
    • generate

      public Object generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object object) throws org.hibernate.HibernateException
      Specified by:
      generate in interface org.hibernate.id.IdentifierGenerator
      Throws:
      org.hibernate.HibernateException
    • getSequenceName

      public org.hibernate.boot.model.relational.QualifiedName getSequenceName()
    • determineIncrementForSequenceEmulation

      protected int determineIncrementForSequenceEmulation(Properties params)