ibatis oracle批量insert,iBATIS批量插入数据到Oracle数据库

/**

* ibatis批量插入数据

* @param recordList

*/

public void insertRecordByList(final List recordList) {

this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

public Object doInSqlMapClient(SqlMapExecutor executor)

throws SQLException {

executor.startBatch();

// 每次提交最大条数

final int batchSize = 200;

int count = 0;

for (Record record : recordList) {

executor.insert("Record.insertRecord", record);

// 每200条数据提交一次

if (++count % batchSize == 0) {

executor.executeBatch();

}

}

// 提交剩余的数据

executor.executeBatch();

return null;

}

});

}