jdbctemplate 批量操作
生活随笔
收集整理的這篇文章主要介紹了
jdbctemplate 批量操作
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
public void addUserBean(List<UserBean> list) { final List<UserBean> tempBpplist = list; String sql="insert into user(id,name,isgood)" +" values(?,?,?)"; jdbcTemplateMysql.batchUpdate(sql,new BatchPreparedStatementSetter() {@Overridepublic int getBatchSize() {return tempBpplist.size(); }@Overridepublic void setValues(PreparedStatement ps, int i)throws SQLException {ps.setInt(1, tempBpplist.get(i).getId()); ps.setString(2, tempBpplist.get(i).getName()); ps.setBoolean(3, tempBpplist.get(i).isGood()); } }); }
轉載于:https://my.oschina.net/u/1015065/blog/378241
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的jdbctemplate 批量操作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 常见网络命令之Ping命令
- 下一篇: redhat6.4使用yum时提示需要注