在ssh整合时出现 错误
Could not obtain transaction-synchronized Session for current thread
在hibernate3时用的是
getCurrentSession()
但在hibernate4一般是用
解决办法:
在 获取session时改为
Session session;
try {
session = sessionFactory.getCurrentSession();
} catch (HibernateException e) {
session = sessionFactory.openSession();
}
return session;
如果有错误,请指出谢谢