Interface CommonInsertMapper<T>
- Type Parameters:
T
- the type of record associated with this mapper
public interface CommonInsertMapper<T>
This is a general purpose mapper for executing various types of insert statements. This mapper is appropriate for
insert statements that do NOT expect generated keys.
-
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.ibatis.executor.BatchResult>
flush()
Flush batched insert statements and return details of the current batch.int
generalInsert
(GeneralInsertStatementProvider insertStatement) Execute an insert statement with input fields supplied directly.int
insert
(InsertStatementProvider<T> insertStatement) Execute an insert statement with input fields mapped to values in a POJO.int
insertMultiple
(MultiRowInsertStatementProvider<T> insertStatement) Execute an insert statement that inserts multiple rows.int
insertSelect
(InsertSelectStatementProvider insertSelectStatement) Execute an insert statement with input fields supplied by a select statement.
-
Method Details
-
insert
@InsertProvider(type=SqlProviderAdapter.class, method="insert") int insert(InsertStatementProvider<T> insertStatement) Execute an insert statement with input fields mapped to values in a POJO.- Parameters:
insertStatement
- the insert statement- Returns:
- the number of rows affected
-
generalInsert
@InsertProvider(type=SqlProviderAdapter.class, method="generalInsert") int generalInsert(GeneralInsertStatementProvider insertStatement) Execute an insert statement with input fields supplied directly.- Parameters:
insertStatement
- the insert statement- Returns:
- the number of rows affected
-
insertSelect
@InsertProvider(type=SqlProviderAdapter.class, method="insertSelect") int insertSelect(InsertSelectStatementProvider insertSelectStatement) Execute an insert statement with input fields supplied by a select statement.- Parameters:
insertSelectStatement
- the insert statement- Returns:
- the number of rows affected
-
insertMultiple
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple") int insertMultiple(MultiRowInsertStatementProvider<T> insertStatement) Execute an insert statement that inserts multiple rows. The row values are supplied by mapping to values in a List of POJOs.- Parameters:
insertStatement
- the insert statement- Returns:
- the number of rows affected
-
flush
Flush batched insert statements and return details of the current batch. This is useful when there is no direct access to the @link(SqlSession
.- Returns:
- details about the current batch including update counts, etc.
-