刚学的时候总是各种错误,解决方法也无厘头的很
将UserDAO里面的的save方法修改
try {
getSession().save(transientInstance);
log.debug("save successful");
}
改为
try {
Session session=HibernateSessionFactory.getSession();
Transaction tc=session.beginTransaction();
session.save(transientInstance);
tc.commit();
session.close();
}