Could not obtain transaction-synchronized Session for current thread原因及解决方案

问题 用sessionFactory.getCurrentSession()这样获取session,抛了这异常。 解决 必须要将使用了sessionFactory.getCurrentSession()获取session的代码所在的方法加入到事务管理器中;否则获取不到session了。 sessionFactory.getCurrentSession()是要基于事务的,才能实现session生命周
相关文章
相关标签/搜索