67,513
社区成员
发帖
与我相关
我的任务
分享
public boolean doAudit() throws Exception {
Session sess = null;
Transaction tx = null;
Connection con = null;
try {
//Hibernate 事务
sess = HibernateCfg.openClearedSession();
tx = HibernateCfg.beginTransaction(sess);
//jdbc事务
con = DBTools.getConnection();
DBTools.beginTransaction(con);
onAudit(sess, con);
DBTools.commit(con);
HibernateCfg.commit(tx);
return true;
} catch (Exception e) {
DBTools.rollback(con);
HibernateCfg.rollBack(tx);
} finally {
DBTools.release(con);
}
return false;
}