有的
Configuration c= this.getSqlSession().getConfiguration();
ManagedTransactionFactory managedTransactionFactory = new ManagedTransactionFactory();
BatchExecutor batchExecutor=new BatchExecutor(c,managedTransactionFactory.newTransaction(this.getSqlSession().getConnection(),false));
int i = 0;
for (T entity : collection) {
batchExecutor.doUpdate(c.getMappedStatement(sql), entity);
if (i++ > 0 && i % BATCH_SIZE == 0) {
batchExecutor.doFlushStatements();
}
}
batchExecutor.doFlushStatements();
是更新一个表的数据吗?要是一张表的话、使用if应该可以吧
你可以写存储过程的实现你那个批量update,
再看看别人怎么说的。
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....