Interface BatchBuilder
- All Superinterfaces:
Serializable, Service
Batch instances.
The core batch lifecycle is split into specializations. Implementors should
create a GroupedBatch for the general mutation executor path, and may
additionally create a SingleStatementBatch for execution paths that
bind directly to one statement shape.
A custom BatchBuilder may be selected either by setting the configuration
property "hibernate.jdbc.batch.builder", or by registering it
as a Java service.
-
Method Summary
Modifier and TypeMethodDescriptionbuildGroupedBatch(BatchKey key, Integer batchSize, Supplier<PreparedStatementGroup> statementGroupSupplier, JdbcCoordinator jdbcCoordinator) Build a batch for the general mutation executor infrastructure.default SingleStatementBatchbuildSingleStatementBatch(BatchKey key, Integer batchSize, PreparableMutationOperation mutationOperation, JdbcCoordinator jdbcCoordinator) Build a batch for a single JDBC statement shape.
-
Method Details
-
buildGroupedBatch
GroupedBatch buildGroupedBatch(BatchKey key, Integer batchSize, Supplier<PreparedStatementGroup> statementGroupSupplier, JdbcCoordinator jdbcCoordinator) Build a batch for the general mutation executor infrastructure.The returned batch owns the
PreparedStatementGroupproduced bystatementGroupSupplier. The supplier is passed instead of an eagerly created group so implementations may decide exactly when statement-group construction should happen.- Parameters:
key- key identifying compatible rows for the batchbatchSize- explicit batch size override, ornullto use the builder's defaultstatementGroupSupplier- supplier for the statement group owned by the batchjdbcCoordinator- JDBC coordinator that will own the active batch- Returns:
- a grouped batch instance
-
buildSingleStatementBatch
default SingleStatementBatch buildSingleStatementBatch(BatchKey key, Integer batchSize, PreparableMutationOperation mutationOperation, JdbcCoordinator jdbcCoordinator) Build a batch for a single JDBC statement shape.The default implementation throws because existing custom builders written for grouped mutation batching do not necessarily know how to build this specialization. Builders that want to support graph-style single statement batching should override this method.
- Parameters:
key- key identifying compatible rows for the batchbatchSize- explicit batch size override, ornullto use the builder's defaultmutationOperation- preparable mutation operation representing the single statement shapejdbcCoordinator- JDBC coordinator that will own the active batch- Returns:
- a single-statement batch instance
-