jdbctemplate 批量操作代码
2018-07-20 来源:open-open
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() {
@Override
public int getBatchSize() {
return tempBpplist.size();
}
@Override
public 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());
}
});
}
标签: Mysql
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
上一篇:KMP算法
下一篇:利用iText导出pdf文件代码
最新资讯
热门推荐