`
wanxiaotao12
  • 浏览: 476861 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ibatis批量操作

 
阅读更多
    public int batchInsert(final List<CardOrderCoupon> cardOrderCouponList, final long orderId) {
        Object obj = this.execute(new SqlMapClientCallback() {
            public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
                executor.startBatch();
                for (CardOrderCoupon cardOrderCoupon : cardOrderCouponList) {
                    cardOrderCoupon.setOrderId(orderId);
                    executor.insert("CardOrderCoupon.addCardOrderCoupon", cardOrderCoupon);
                }
                return executor.executeBatch();
            }
        });
        return (Integer) obj;
    }

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics