Record Class DatabaseConfiguration

java.lang.Object
java.lang.Record
io.bloviate.db.DatabaseConfiguration
Record Components:
batchSize - the number of rows to include in each batch INSERT operation
defaultRowCount - the default number of rows to generate for each table
databaseSupport - the database-specific support implementation
tableConfigurations - optional per-table configuration overrides
generatorRegistry - optional registry of custom generator rules (by column-name pattern, vendor type name, or JDBCType), consulted between per-column overrides and the databaseSupport defaults; may be null
seed - the base seed for reproducible generation; vary it for a different dataset
commitStrategy - how the engine commits inserted rows; defaults to CommitStrategy.connectionDefault() (autocommit untouched) when null
bulkLoadStrategy - how the engine orders fills relative to foreign-key dependencies; defaults to BulkLoadStrategy.ordered() (dependency-ordered) when null

public record DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, GeneratorRegistry generatorRegistry, long seed, CommitStrategy commitStrategy, BulkLoadStrategy bulkLoadStrategy) extends Record
Configuration settings for database filling operations.

This record encapsulates all configuration parameters needed to control the database filling process, including batch sizes, row counts, database-specific support, and table-specific overrides.

The configuration supports:

  • Global batch size for INSERT operations
  • Default row count applied to all tables
  • Database-specific support implementation
  • Per-table configuration overrides
  • An optional registry of custom generator rules
  • A base seed for reproducible, controllable data generation

The seed makes a fill reproducible: the same schema filled with the same seed always produces identical data, and changing the seed produces a different but equally reproducible dataset. See DatabaseUtils.columnSeed(Column, long) for how per-column seeds are derived.

Author:
Tim Veil
See Also:
  • Constructor Details

    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, GeneratorRegistry generatorRegistry, long seed, CommitStrategy commitStrategy, BulkLoadStrategy bulkLoadStrategy)
      Normalizes a null commitStrategy to CommitStrategy.connectionDefault() and a null bulkLoadStrategy to BulkLoadStrategy.ordered() so the back-compatible behavior applies whenever a caller does not specify them.
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations)
      Creates a configuration with no custom GeneratorRegistry and a base seed of 0.
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, GeneratorRegistry generatorRegistry)
      Creates a configuration with a custom GeneratorRegistry and a base seed of 0.
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      generatorRegistry - optional registry of custom generator rules; may be null
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, long seed)
      Creates a configuration with the given base seed and no custom GeneratorRegistry.
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      seed - the base seed for reproducible generation
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, long seed, CommitStrategy commitStrategy)
      Creates a configuration with the given base seed and CommitStrategy, and no custom GeneratorRegistry.
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      seed - the base seed for reproducible generation
      commitStrategy - how the engine commits inserted rows; may be null for the default
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, long seed, CommitStrategy commitStrategy, BulkLoadStrategy bulkLoadStrategy)
      Creates a configuration with the given base seed, CommitStrategy and BulkLoadStrategy, and no custom GeneratorRegistry.
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      seed - the base seed for reproducible generation
      commitStrategy - how the engine commits inserted rows; may be null for the default
      bulkLoadStrategy - how the engine orders fills; may be null for the default
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, GeneratorRegistry generatorRegistry, long seed)
      Creates a configuration with a custom GeneratorRegistry and base seed, and the default CommitStrategy (preserves the original six-argument signature).
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      generatorRegistry - optional registry of custom generator rules; may be null
      seed - the base seed for reproducible generation
    • DatabaseConfiguration

      public DatabaseConfiguration(int batchSize, long defaultRowCount, DatabaseSupport databaseSupport, Set<TableConfiguration> tableConfigurations, GeneratorRegistry generatorRegistry, long seed, CommitStrategy commitStrategy)
      Creates a configuration with a custom GeneratorRegistry, base seed and CommitStrategy, and the default BulkLoadStrategy (preserves the original seven-argument signature).
      Parameters:
      batchSize - the number of rows to include in each batch INSERT operation
      defaultRowCount - the default number of rows to generate for each table
      databaseSupport - the database-specific support implementation
      tableConfigurations - optional per-table configuration overrides
      generatorRegistry - optional registry of custom generator rules; may be null
      seed - the base seed for reproducible generation
      commitStrategy - how the engine commits inserted rows; may be null for the default
  • Method Details

    • tableConfiguration

      public TableConfiguration tableConfiguration(String tableName)
      Retrieves the table-specific configuration for the given table name.
      Parameters:
      tableName - the name of the table to find configuration for
      Returns:
      the table configuration if found, or null if using defaults
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • batchSize

      public int batchSize()
      Returns the value of the batchSize record component.
      Returns:
      the value of the batchSize record component
    • defaultRowCount

      public long defaultRowCount()
      Returns the value of the defaultRowCount record component.
      Returns:
      the value of the defaultRowCount record component
    • databaseSupport

      public DatabaseSupport databaseSupport()
      Returns the value of the databaseSupport record component.
      Returns:
      the value of the databaseSupport record component
    • tableConfigurations

      public Set<TableConfiguration> tableConfigurations()
      Returns the value of the tableConfigurations record component.
      Returns:
      the value of the tableConfigurations record component
    • generatorRegistry

      public GeneratorRegistry generatorRegistry()
      Returns the value of the generatorRegistry record component.
      Returns:
      the value of the generatorRegistry record component
    • seed

      public long seed()
      Returns the value of the seed record component.
      Returns:
      the value of the seed record component
    • commitStrategy

      public CommitStrategy commitStrategy()
      Returns the value of the commitStrategy record component.
      Returns:
      the value of the commitStrategy record component
    • bulkLoadStrategy

      public BulkLoadStrategy bulkLoadStrategy()
      Returns the value of the bulkLoadStrategy record component.
      Returns:
      the value of the bulkLoadStrategy record component