struts2,hibernate3,mysql修改时报错
Session session = HibernateUtil.getCurrentSessionFactory().openSession();
Transaction transaction = null;
try {
transaction = session.beginTransaction();
session.merge(user);
// 本来使用 saveOrupdate() 但是报错 transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
throw e;
} finally {
if (session != null) {
session.close();
}
}
posted on 2008-04-18 16:13
选宝网an9 阅读(2739)
评论(0) 编辑 收藏 所属分类:
Java Exception&Error