ibatis之批量操作实例

来源:互联网 发布:利为汇seo营销培训 编辑:程序博客网 时间:2024/05/29 13:35
 public void batchUpdateExec(String sqlId, List<Object> 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++) {
                            this.getSqlMapClient().update(sqlId, param.get(i));
                        }
                        this.getSqlMapClient().executeBatch();
                    } catch (SQLException e) {
                        throw new DaoException(e);
                    }
                }
            }
        }
0 0
原创粉丝点击