分析 org.hibernate.HibernateException: No Session found for current thread
2015-02-18 13:22
471 查看
/**
*
* org.hibernate.HibernateException: No Session found for current thread
* 分析:getCurrentSession()和当前事务有关系
*
* Spring hibernate 事务的流程
*
* 1.在方法开始之前
* ①.获取Session
* ②.把Session 和当前线程绑定,这样就可以在Dao中 使用SessionFactory 的
* getCurrentSession() 方法来获取Session 了
* ③.开启事务
*
* 2.执行业务方法
* 1)出现异常
* ①.回滚事务
* 2)正常结束
* ①.提交事务
* finally{
* ②.和当前线程绑定的Session解除绑定
* ③.关闭Session
* }
*
* 结论:
* 只要使用getCurrentSession()来获取Session,则
* ①必须配置事务
* ②必须在配置事务属性时,包含所有的业务方法
*/
*
* org.hibernate.HibernateException: No Session found for current thread
* 分析:getCurrentSession()和当前事务有关系
*
* Spring hibernate 事务的流程
*
* 1.在方法开始之前
* ①.获取Session
* ②.把Session 和当前线程绑定,这样就可以在Dao中 使用SessionFactory 的
* getCurrentSession() 方法来获取Session 了
* ③.开启事务
*
* 2.执行业务方法
* 1)出现异常
* ①.回滚事务
* 2)正常结束
* ①.提交事务
* finally{
* ②.和当前线程绑定的Session解除绑定
* ③.关闭Session
* }
*
* 结论:
* 只要使用getCurrentSession()来获取Session,则
* ①必须配置事务
* ②必须在配置事务属性时,包含所有的业务方法
*/
相关文章推荐
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException No Session found for current thread
- SpringMVC3+Hibernate4问题:org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- nested exception is org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- 关于异常: org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- Bug库____org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread
- 在hibernate4中出现org.hibernate.HibernateException: No Session found for current thread
- org.hibernate.HibernateException: No Session found for current thread的解决办法
- org.hibernate.HibernateException: No Session found for current thread
- Hibernate No Session found for current thread异常分析