标签:bsp tac get ima amp word ase -- 技术
标签:
springbatchpreparedstatementsetter |
分类: spring |
public void batchInsertRows(String sql,final List<Object[]> dataSet) throws Exception{
BatchPreparedStatementSetter setter=new BatchPreparedStatementSetter(){
public int
getBatchSize(){
return
dataSet.size();
}
public void
setValues(PreparedStatement ps,int i){
Object[] obj
= dataSet.get(i);
int nextId =
getNextId();
try{
ps.setLong(1,nextId);
ps.setLong(2,Integer.parseInt(obj[0].toString()));
ps.setLong(3,Integer.parseInt(obj[1].toString()));
ps.setString(4,(String)obj[2]);}
catch(Exception
e){
e.printStackTrace();
}
}
};
jdbcTemplate.batchUpdate(sql,setter);
}
BatchPreparedStatementSetter,用法
标签:bsp tac get ima amp word ase -- 技术
原文地址:http://www.cnblogs.com/xing-cctv/p/6327365.html