Class TableFiller
java.lang.Object
io.bloviate.db.TableFiller
- All Implemented Interfaces:
Fillable
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionTableFiller(Connection connection, Database database, DatabaseConfiguration databaseConfiguration, Table table, CommitStrategy commitStrategy) Constructs a new TableFiller with an explicitCommitStrategyoverride. -
Method Summary
Modifier and TypeMethodDescriptionvoidfill()Fills this single table with generated data, respecting its column types and foreign-key relationships.
-
Constructor Details
-
TableFiller
public TableFiller(Connection connection, Database database, DatabaseConfiguration databaseConfiguration, Table table, CommitStrategy commitStrategy) Constructs a new TableFiller with an explicitCommitStrategyoverride.- Parameters:
connection- the database connection to use for filling the tabledatabase- the database metadata containing table relationshipsdatabaseConfiguration- the configuration settings for the fill operationtable- the table to be filled with datacommitStrategy- the commit strategy to use; falls back to the configuration's when null
-
-
Method Details
-
fill
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 theDatabaseSupportdefault) and the engine seeds each one for reproducibility. Rows are then produced in batches of the configured size and inserted through aPreparedStatement. Unless theCommitStrategyleaves 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:
fillin interfaceFillable- Throws:
SQLException- if any database access error occurs during the fill operation
-