Class 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's SequenceGenerator.

    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  
      • Fields inherited from interface org.hibernate.id.IdentifierGenerator

        CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
    • 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 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

        generatesOnInsert, generatesOnUpdate, generatesSometimes
      • Methods inherited from interface org.hibernate.id.IdentifierGenerator

        generate, getEventTypes, registerExportables, supportsJdbcBatchInserts
    • Field Detail

      • NO_PARAMS

        public static final java.lang.Object[] NO_PARAMS
    • Constructor Detail

      • ReactiveSequenceIdentifierGenerator

        public ReactiveSequenceIdentifierGenerator()
    • Method Detail

      • configure

        public void configure​(org.hibernate.type.Type type,
                              java.util.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​(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 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.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 interface org.hibernate.id.IdentifierGenerator
        Throws:
        org.hibernate.HibernateException
      • getSequenceName

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

        protected int determineIncrementForSequenceEmulation​(java.util.Properties params)