Interface GroupedBatch

All Superinterfaces:
Batch

@Incubating public interface GroupedBatch extends Batch

Batch variant based on a group of prepared statements.

A grouped batch is the batching model used by the general mutation executor infrastructure. Each logical row may contribute bindings to more than one JDBC statement in the statement group, for example when a mutation spans multiple tables. The supplied JdbcValueBindings describe the values for the current logical row, and the batch applies those values to each included statement before calling PreparedStatement.addBatch().

This contract is intentionally separate from SingleStatementBatch. Code that already has a single prepared statement shape and can bind directly to that statement does not need to manufacture a statement group just to use the batching lifecycle.

Since:
8.0
  • Method Details

    • getStatementGroup

      PreparedStatementGroup getStatementGroup()

      The group of prepared statements managed by this batch.

      Callers may need access to the group when using mutation executors that expose statement details for generated values handling or other execution infrastructure. The returned group is owned by the batch and is released when the batch is released.

    • addToBatch

      void addToBatch(JdbcValueBindings jdbcValueBindings, TableInclusionChecker inclusionChecker)

      Add one logical row to this grouped batch.

      The batch applies jdbcValueBindings to the statements selected by inclusionChecker. Passing null for inclusionChecker means all statements in the group are included. If adding the row fills the configured batch size, the implementation may execute the JDBC batch immediately.

      Parameters:
      jdbcValueBindings - values for the current logical mutation row
      inclusionChecker - optional selector for statements/tables that should be included for this row
    • addToBatch

      void addToBatch(JdbcValueBindings jdbcValueBindings, TableInclusionChecker inclusionChecker, StaleStateMapper staleStateMapper)

      Add one logical row to this grouped batch with stale-state exception mapping.

      The mapper is associated with the row being added and is used only if JDBC row-count verification reports a stale-state condition for that row. This lets higher-level mutation code translate or suppress stale-state failures without changing normal successful batch result processing.

      Parameters:
      jdbcValueBindings - values for the current logical mutation row
      inclusionChecker - optional selector for statements/tables that should be included for this row
      staleStateMapper - optional mapper for stale-state failures associated with this row