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 Details

    • renderedTableName

      protected String renderedTableName
    • segmentColumnName

      protected String segmentColumnName
    • valueColumnName

      protected String 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:
      configure in interface org.hibernate.id.Configurable
      Specified by:
      configure in interface org.hibernate.id.IdentifierGenerator
    • 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
    • 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
    • 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

      protected String determineSegmentValue(Properties params)
    • determineDefaultSegmentValue

      protected String determineDefaultSegmentValue(Properties params)
    • determineInitialValue

      protected int determineInitialValue(Properties params)
    • determineIncrement

      protected int determineIncrement(Properties params)
    • updateParameters

      protected Object[] updateParameters(long currentValue, long updatedValue)
    • insertParameters

      protected Object[] insertParameters(long insertedValue)
    • selectParameters

      protected Object[] selectParameters()
    • buildSelectQuery

      protected String buildSelectQuery(org.hibernate.dialect.Dialect dialect)
    • buildUpdateQuery

      protected String buildUpdateQuery(org.hibernate.dialect.Dialect dialect)
    • buildInsertQuery

      protected String buildInsertQuery(org.hibernate.dialect.Dialect dialect)