Class SqlBatchInsertQuery

All Implemented Interfaces:
BatchInsertQuery, BatchModifyQuery, Query

public class SqlBatchInsertQuery extends SqlBatchModifyQuery implements BatchInsertQuery
A query that performs batch insert operations using SQL statements.

This class extends SqlBatchModifyQuery to provide functionality for executing batch INSERT statements. It initializes the SQL kind to SqlKind.INSERT to indicate that this query performs INSERT operations.

  • Constructor Details

    • SqlBatchInsertQuery

      public SqlBatchInsertQuery()
      Constructs a new instance.

      This constructor initializes the query with SqlKind.INSERT to indicate that it performs INSERT operations.

  • Method Details

    • generateId

      public 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.

      This implementation does nothing because this query does not support auto-generated keys.

      Specified by:
      generateId in interface BatchInsertQuery
      Parameters:
      statement - the statement used for the batch operation
      index - the index of the element in the batch
    • isBatchSupported

      public 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.

      This implementation always returns true because SQL batch queries are always supported.

      Specified by:
      isBatchSupported in interface BatchInsertQuery
      Returns:
      true if batch operations are supported, false otherwise