欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

ibatis之批量操作实例

程序员文章站 2022-05-28 16:33:41
...

public void batchUpdateExec(String sqlId, ListObject param) throws DaoException { if (sqlId != null sqlId.length() 0) { if (param != null param.size() 0) { try { this.getSqlMapClient().startBatch(); for (int i = 0; i param.size(); i) { thi

public void batchUpdateExec(String sqlId, List param) throws DaoException {
if (sqlId != null && sqlId.length() > 0) {
if (param != null && param.size() > 0) {
try {
this.getSqlMapClient().startBatch();
for (int i = 0; i this.getSqlMapClient().update(sqlId, param.get(i));
}
this.getSqlMapClient().executeBatch();
} catch (SQLException e) {
throw new DaoException(e);
}
}
}
}