Interface DatabaseStructure

All Superinterfaces:
ExportableProducer
All Known Implementing Classes:
OrderedSequenceStructure, SequenceStructure, TableStructure

public interface DatabaseStructure extends ExportableProducer
Encapsulates definition of the underlying data structure backing a sequence-style generator.
  • Method Details

    • getPhysicalName

      QualifiedName getPhysicalName()
      The physical name of the database structure (table or sequence).

      Only available after registerExportables(Database) has been called.

      Returns:
      The structure name.
    • getTimesAccessed

      int getTimesAccessed()
      How many times has this structure been accessed through this reference?
      Returns:
      The number of accesses.
    • getInitialValue

      int getInitialValue()
      The configured initial value
      Returns:
      The configured initial value
    • getIncrementSize

      int getIncrementSize()
      The configured increment size
      Returns:
      The configured increment size
    • buildCallback

      A callback to be able to get the next value from the underlying structure as needed.
      Parameters:
      session - The session.
      Returns:
      The next value.
    • prepare

      @Deprecated default void prepare(Optimizer optimizer)
      Deprecated.
      Prepare this structure for use. Called sometime after instantiation, but before first use.
      Parameters:
      optimizer - The optimizer being applied to the generator.
    • configure

      default void configure(Optimizer optimizer)
      Configures this structure with the given arguments.

      Called just after instantiation, before initialize(SqlStringGenerationContext)

      Parameters:
      optimizer - The optimizer being applied to the generator.
    • registerExportables

      void registerExportables(Database database)
      Register database objects involved in this structure, e.g. sequences, tables, etc.

      This method is called just once, after configure(Optimizer), but before initialize(SqlStringGenerationContext).

      Specified by:
      registerExportables in interface ExportableProducer
      Parameters:
      database - The database instance
    • registerExtraExportables

      default void registerExtraExportables(Table table, Optimizer optimizer)
      Register additional database objects which need to be aware of the table for which this structure is used to generate values. Used to deal with automatic sequence resynchronization after data import.
      Parameters:
      table - The table for which this structure is used to generate values
      optimizer - The Optimizer for this generator
      Since:
      7.2
      See Also:
    • initialize

      default void initialize(SqlStringGenerationContext context)
      Initializes this structure, in particular pre-generates SQL as necessary.

      This method is called just once, after registerExportables(Database), before first use.

      Parameters:
      context - A context to help generate SQL strings
    • isPhysicalSequence

      boolean isPhysicalSequence()
      Is the structure physically a sequence?
      Returns:
      true if the actual database structure is a sequence; false otherwise.
    • getAllSqlForTests

      @Deprecated default String[] getAllSqlForTests()
      Deprecated.
      Exposed for tests only.