- All Superinterfaces:
BatchModifyQuery,Query
- All Known Implementing Classes:
AutoBatchInsertQuery,SqlBatchInsertQuery,SqlFileBatchInsertQuery
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 Summary
Modifier and TypeMethodDescriptionvoidgenerateId(Statement statement, int index) Generates an ID for a single inserted row in the batch.default voidgenerateIds(Statement statement, int position, int size) Generates IDs for the batch.booleanDetermines if batch operations are supported for this query.Methods inherited from interface org.seasar.doma.jdbc.query.BatchModifyQuery
getBatchSize, getSql, getSqlExecutionSkipCause, getSqlLogType, getSqls, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequiredMethods inherited from interface org.seasar.doma.jdbc.query.Query
comment, complete, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout, prepare
-
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
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 operationindex- the index of the element in the batch
-
generateIds
Generates IDs for the batch.- Parameters:
statement- the statementposition- the position of the first element in the batchsize- the size of the executed batch
-