Could not obtain transaction-synchronized Session for current thread
2017-11-02 20:48
1796 查看
spring4. 3 + hibernate4.3 执行sessionFactory.getCurrentSession() 抛 Could not obtain transaction-synchronized Session for current thread 异常。
解决方法:添加
OpenSessionInViewFilter的主要功能是用来把一个Hibernate Session和一次完整的请求过程对应的线程相绑定。Open Session In View在request把session绑定到当前thread期间一直保持hibernate session在open状态,使session在request的整个期间都可以使用。
解决方法:添加
<filter> <filter-name>openSessionInView</filter-name> <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>openSessionInView</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
OpenSessionInViewFilter的主要功能是用来把一个Hibernate Session和一次完整的请求过程对应的线程相绑定。Open Session In View在request把session绑定到当前thread期间一直保持hibernate session在open状态,使session在request的整个期间都可以使用。
相关文章推荐
- springmvc+spring4+hibernate4整合Could not obtain transaction-synchronized Session for current thread
- 关于Hibernate Could not obtain transaction-synchronized Session for current thread
- 错误记录(九)Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Struts Problem Report :Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- SpringMVC中Could not obtain transaction-synchronized Session for current thread的解决方案
- 【转】关于Hibernate Could not obtain transaction-synchronized Session for current thread
- 由Could not obtain transaction-synchronized Session for current thread错误处理引申到声明式与编程式事务处理
- Could not obtain transaction-synchronized Session for current thread
- ssh整合 出现Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- spring+hibernate Could not obtain transaction-synchronized Session for current thread
- SpringMVC中Could not obtain transaction-synchronized Session for current thread的解决方案
- Could not obtain transaction-synchronized Session for current thread