Class DatabaseFiller
java.lang.Object
io.bloviate.db.DatabaseFiller
- All Implemented Interfaces:
Fillable
Main entry point for filling database tables with generated data.
The DatabaseFiller orchestrates the entire database filling process by:
- Analyzing database metadata to discover tables, columns, and relationships
- Building a dependency graph based on foreign key relationships
- Using topological sorting to determine the proper fill order
- Delegating individual table filling to
TableFillerinstances
The filling process respects foreign key constraints by ensuring parent tables are populated before their dependent child tables. Self-referencing tables are detected and logged as potential issues.
Example usage:
DatabaseConfiguration config = new DatabaseConfiguration(batchSize, recordCount,
databaseSupport, tableConfigs);
new DatabaseFiller.Builder(connection, config)
.build()
.fill();
- Author:
- Tim Veil
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing DatabaseFiller instances. -
Method Summary
Modifier and TypeMethodDescriptionvoidfill()Fills all tables in the database with generated data.
-
Method Details
-
fill
Fills all tables in the database with generated data.This method performs the complete database filling workflow:
- Retrieves database metadata including tables, columns, and foreign keys
- Builds a directed graph representing table dependencies
- Performs topological sorting to determine fill order
- Fills each table in dependency order using
TableFiller
Progress and timing information is logged throughout the process. A visualization link for the dependency graph is also provided in the logs.
- Specified by:
fillin interfaceFillable- Throws:
SQLException- if any database operation fails during the filling process
-