关于批量操作需要注意的问题,要把每一个方法都指定相同的事务

Error:Cannot change the ExecutorType when there is an existing transaction//要把每个方法都改成批量操作

Listsalenos=shopsettlementSalenoDao.getList(tenantId,criteria,BaseDao.EXECUTOR_BATCH);
if (salenos != null && salenos.size() > 0) {
for (ShopsettlementSaleno shopSaleno : salenos) {
ShopsettlementSalenoHis salenoHis = new  ShopsettlementSalenoHis();
BeanUtils.copyProperties(shopSaleno,salenoHis);
salenoHis.setDjsdate(new Date());
salenoList.add(salenoHis);
ids.add(shopSaleno.getId());
}
shopsettlementSalenoHisDao.save(tenantId, salenoList);
shopsettlementSalenoDao.delete(tenantId, ids);
}else{
throw new DataErrorException("没有待结算的数据!");
}

你可能感兴趣的:(关于批量操作需要注意的问题,要把每一个方法都指定相同的事务)