Class TableFiller

java.lang.Object
io.bloviate.db.TableFiller
All Implemented Interfaces:
Fillable

public class TableFiller extends Object implements Fillable
Fills a database table with generated data. This class handles the population of a single table with synthetic data, respecting foreign key constraints and using appropriate data generators for each column type.
Since:
1.0.0
  • Constructor Details

    • TableFiller

      public TableFiller(Connection connection, Database database, DatabaseConfiguration databaseConfiguration, Table table, CommitStrategy commitStrategy)
      Constructs a new TableFiller with an explicit CommitStrategy override.
      Parameters:
      connection - the database connection to use for filling the table
      database - the database metadata containing table relationships
      databaseConfiguration - the configuration settings for the fill operation
      table - the table to be filled with data
      commitStrategy - the commit strategy to use; falls back to the configuration's when null
  • Method Details

    • fill

      public void fill() throws SQLException
      Fills this single table with generated data, respecting its column types and foreign-key relationships.

      Generators are resolved once per column (per-column override, then custom registry, then any applicable CHECK/enum constraint, then the DatabaseSupport default) and the engine seeds each one for reproducibility. Rows are then produced in batches of the configured size and inserted through a PreparedStatement. Unless the CommitStrategy leaves the connection on its default, the engine owns the transaction: autocommit is turned off for the fill, commits happen at the configured cadence, the work is rolled back on error, and the prior autocommit setting is restored on completion. When a row range is configured this fills only that one partition; otherwise it fills the whole table.

      Specified by:
      fill in interface Fillable
      Throws:
      SQLException - if any database access error occurs during the fill operation