hibernate3.0 + eclipse开发的奇怪问题
BookDAO.java
-------------
...
public void save(Book transientInstance) {
Session session = null;
Transaction tx = null;
try {
session = this.getSession();
tx = session.beginTransaction();
session.save(transientInstance);
tx.commit();
log.debug( "save successful ");
} catch (
RuntimeException re) {
log.error( "save failed ", re);
tx.rollback();
throw re;
}finally{
if(session != null)
{
session.close();
}
}
}
public void update(Book detachedInstance) {
Session session = null;
Transaction tx = null;
try {
session = this.getSession();
tx = session.beginTransaction();
session.update(detachedInstance);
tx.commit();
log.debug( "update successful ");
} catch (RuntimeException re) {
tx.rollback();
throw re;