java.lang.Object
org.itsallcode.jdbc.batch.PreparedStatementBatchBuilder
Builder for
PreparedStatementBatch. Create a new builder instance
using SimpleConnection.preparedStatementBatch().-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum batch size. -
Constructor Summary
ConstructorsConstructorDescriptionPreparedStatementBatchBuilder(Function<String, SimplePreparedStatement> statementFactory) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the batch inserter.Define table and column names used for generating theINSERTstatement.into(Identifier tableName, List<Identifier> columnNames) Define table and column names used for generating theINSERTstatement.maxBatchSize(int maxBatchSize) Define maximum batch size, usingDEFAULT_MAX_BATCH_SIZEas default.Define the SQL statement to be used for the batch job, e.g.
-
Field Details
-
DEFAULT_MAX_BATCH_SIZE
Default maximum batch size.- See Also:
-
-
Constructor Details
-
PreparedStatementBatchBuilder
Create a new instance.- Parameters:
statementFactory- factory for creatingSimplePreparedStatement.
-
-
Method Details
-
sql
Define the SQL statement to be used for the batch job, e.g.INSERTorUPDATE.- Parameters:
sql- SQL statement- Returns:
thisfor fluent programming
-
into
Define table and column names used for generating theINSERTstatement.- Parameters:
tableName- table namecolumnNames- column names- Returns:
thisfor fluent programming
-
into
Define table and column names used for generating theINSERTstatement.- Parameters:
tableName- table namecolumnNames- column names- Returns:
thisfor fluent programming
-
maxBatchSize
Define maximum batch size, usingDEFAULT_MAX_BATCH_SIZEas default.- Parameters:
maxBatchSize- maximum batch size- Returns:
thisfor fluent programming
-
build
Build the batch inserter.- Returns:
- the batch inserter
-