HibernateTemplate 类使用(二)

2014-11-24 00:14:20 · 作者: · 浏览: 1
egun = true;
committed = false;
rolledBack = false;

if (timeout > 0) {
jdbcContext.getConnectionManager().getBatcher().setTransactionTimeout(timeout);
}

jdbcContext.afterTransactionBegin(this);
}


在直接使用Hibernate时,要在事务结束的时候,写上一句:tx.commit(),这个commit()的源码为:

public void commit() throws HibernateException {
if (!begun) {
throw new TransactionException("Transaction not successfully started");
}

log.debug("commit");