Interface BatchInsertQuery

All Superinterfaces:
BatchModifyQuery, Query
All Known Implementing Classes:
AutoBatchInsertQuery, SqlBatchInsertQuery, SqlFileBatchInsertQuery

public interface BatchInsertQuery extends BatchModifyQuery
An interface for batch INSERT queries.

This interface represents a query that performs batch INSERT operations. It extends BatchModifyQuery to inherit common batch data modification functionality while specializing for INSERT operations.

Implementations of this interface handle the execution of multiple INSERT statements as a single batch operation for improved performance, and provide methods for generating IDs for inserted rows.

  • Method Details

    • isBatchSupported

      boolean isBatchSupported()
      Determines if batch operations are supported for this query.

      Some database operations or configurations may not support batch processing. This method allows implementations to indicate whether batch operations can be used.

      Returns:
      true if batch operations are supported, false otherwise
    • generateId

      void generateId(Statement statement, int index)
      Generates an ID for a single inserted row in the batch.

      This method is called after executing the batch to generate IDs for rows that use auto-generated keys or sequences.

      Parameters:
      statement - the statement used for the batch operation
      index - the index of the element in the batch
    • generateIds

      default void generateIds(Statement statement, int position, int size)
      Generates IDs for the batch.
      Parameters:
      statement - the statement
      position - the position of the first element in the batch
      size - the size of the executed batch