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 int
Default 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 theINSERT
statement.into
(Identifier tableName, List<Identifier> columnNames) Define table and column names used for generating theINSERT
statement.maxBatchSize
(int maxBatchSize) Define maximum batch size, usingDEFAULT_MAX_BATCH_SIZE
as 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.INSERT
orUPDATE
.- Parameters:
sql
- SQL statement- Returns:
this
for fluent programming
-
into
Define table and column names used for generating theINSERT
statement.- Parameters:
tableName
- table namecolumnNames
- column names- Returns:
this
for fluent programming
-
into
Define table and column names used for generating theINSERT
statement.- Parameters:
tableName
- table namecolumnNames
- column names- Returns:
this
for fluent programming
-
maxBatchSize
Define maximum batch size, usingDEFAULT_MAX_BATCH_SIZE
as default.- Parameters:
maxBatchSize
- maximum batch size- Returns:
this
for fluent programming
-
build
Build the batch inserter.- Returns:
- the batch inserter
-