spring2.0.8 批量处理
来源:互联网 发布:哈尔滨 软件开发招聘 编辑:程序博客网 时间:2024/04/28 09:58
- public int[] updateKscj(final String[] bmglids,final double[] llbzs,final double[] llzys, final double[] scs){
-
- int[] updateCounts = super.getJdbcTemplate().batchUpdate(
- "update xj_bmgl set bmgl_llbz = ?, bmgl_llzy = ?,bmgl_llzf=?,bmgl_sc=? where bmgl_id = ?",
- new BatchPreparedStatementSetter() {
- public void setValues(PreparedStatement ps, int i) throws SQLException {
- ps.setDouble(1,llbzs[i] );
- ps.setDouble(2,llzys[i] );
- ps.setDouble(3,llbzs[i]+llzys[i] );
- ps.setDouble(4,scs[i] );
- ps.setString(5,bmglids[i]);
- }
- public int getBatchSize() {
- return bmglids.length;
- }
- } );
- return updateCounts;
-
- }