public boolean modTx(Stock model) {
boolean ret = false;
SqlSession session = ConnPool.getSqlSession(PoolName.P1);
try {
**session.update(updateRemark, model);
session.update(updateProduce, model);**
ConnPool.commit(session);
ret = true;
} catch (Exception e) {
ConnPool.rollback(session);
ret = false;
throw new DaoException(e);
} finally {
ConnPool.close(session);
}
return ret;
}
事务操作时,如何共用代码, 前后的代码是相同的,只是中间的多个修改语句不一样。