Package guru.mikelue.foxglove.jdbc
Class JdbcDataGenerator
java.lang.Object
guru.mikelue.foxglove.jdbc.JdbcDataGenerator
- All Implemented Interfaces:
DataGenerator<JdbcTableFacet>,SettingAware<DataGenerator<JdbcTableFacet>>
JDBC implementation of
DataGenerator.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default batch size for insertion of rows. -
Constructor Summary
ConstructorsConstructorDescriptionJdbcDataGenerator(Connection connection) Uses the database and joins the transaction of the given connection.JdbcDataGenerator(DataSource dataSource) Uses the given data source as the target database for generated data. -
Method Summary
Modifier and TypeMethodDescriptionintgenerate(List<JdbcTableFacet> tableFacets) Performs the data generating for the given table facets.setBatchSize(int batchSize) Sets the batch size for insertion of rows.withSetting(DataSettingInfo setting) This object has lower priority than table facet's own setting, yet has higher priority thanDataSetting.defaults().Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface guru.mikelue.foxglove.DataGenerator
generate
-
Field Details
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZEThe default batch size for insertion of rows.- See Also:
-
-
Constructor Details
-
JdbcDataGenerator
Uses the given data source as the target database for generated data.- Parameters:
dataSource- The data source to use
-
JdbcDataGenerator
Uses the database and joins the transaction of the given connection.- Parameters:
connection- The connection to use
-
-
Method Details
-
setBatchSize
Sets the batch size for insertion of rows.- Parameters:
batchSize- The batch size for insertion of rows- Returns:
- This instance
-
generate
Description copied from interface:DataGeneratorPerforms the data generating for the given table facets.- Specified by:
generatein interfaceDataGenerator<JdbcTableFacet>- Parameters:
tableFacets- The table facets- Returns:
- The total number of rows generated
- Throws:
RuntimeJdbcException- See Also:
-
withSetting
This object has lower priority than table facet's own setting, yet has higher priority thanDataSetting.defaults().- Specified by:
withSettingin interfaceSettingAware<DataGenerator<JdbcTableFacet>>- Parameters:
setting- The setting to use- Returns:
- This instance
-