/**
     *
     * 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的更多相关文章

  1. org.hibernate.HibernateException: No Session found for current thread

    spring.springmvc和hibernate整合 在sessionFactory.getCurrentSession()时,出现以下异常 No Session found for curren ...

  2. spring+hibernate整合:报错org.hibernate.HibernateException: No Session found for current thread

    spring+hibernate整合:报错信息如下 org.hibernate.HibernateException: No Session found for current thread at o ...

  3. SSH dao层异常 org.hibernate.HibernateException: No Session found for current thread

    解决方法: 在 接口方法中添加 事务注解 即可. public interface IBase<PK extends Serializable, T> { @Transactional v ...

  4. hibernate在使用getCurrentSession时提示no session found for current thread

    大致错误片段 org.hibernate.HibernateException: No Session found for current thread at org.springframework. ...

  5. Hibernate4集成spring4报错----No Session found for current thread

    在编写一个Hibernate4集成spring4的小demo的时候出现了该错误: org.hibernate.HibernateException: No Session found for curr ...

  6. 关于spring3中No Session found for current thread!and Transaction的配置和管理(转)

    今天我是特别的郁闷,本来项目做到一半,以前都好好的,结果下午就出现问题,苦逼的到现在才解决.它出现问题的时候都一声不坑, ,(天啦,现在才发现CSDN啥时候把QQ表情给整过来了)就在注册用户的时候,咦 ...

  7. Hibernate4 No Session found for current thread原因

    Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for curre ...

  8. SSH2 No Session found for current thread原因

    Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for curre ...

  9. Hibernate4 No Session found for current thread

    Hibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession, 可能会报一个错:“No Session found for curre ...

随机推荐

  1. 一个基于Socket的http请求监听程序实现

    首先来看以下我们的需求: 用java编写一个监听程序,监听指定的端口,通过浏览器如http://localhost:7777来访问时,可以把请求到的内容记录下来,记录可以存文件,sqlit,mysql ...

  2. Behave 基础

    在你使用behave或其他BDD框架之前, 你应该选择一个断言库. python有很多这方面的第三方库.例如: hamcrest,nose.tools,  should-dsl, sure, comp ...

  3. c#与IronPython Clojure-clr的调用

    一,python 安装ironpython http://ironpython.net/ 新建控制台程序,引入 IronPython,Microsoft.Scripting 新建xxx.py文件 va ...

  4. win10 uwp 重启软件

    在16299支持在软件自己重启,不需要让用户点击关闭然后启动,虽然我还不知道这个有什么用.本文告诉大家如何让软件关闭重新打开. 首先需要使用的版本是 16299 ,然后使用 RequestRestar ...

  5. debian上安装docker ce

    在Debian9上安装Docker CE 使用从包中安装的方式 Docker是一个开源的容器引擎,它有助于更快地交付产品.Docker可将应用程序和基础设施层隔离,并且将基础设施当作程序一样进行管理. ...

  6. Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from

    Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from     Hi ...

  7. SpringMVC 面试题

    SpringMVC 面试题 什么是Spring MVC ?简单介绍下你对springMVC的理解? Spring MVC是一个基于MVC架构的用来简化web应用程序开发的应用开发框架,它是Spring ...

  8. 请整体描述Java异常体系

    java把异常当做对象来处理,并定义一个基类Throwable作为所有异常的超类.在java API中已经定义了许多异常的类,这些异常分为两大类,错误Error和异常Exception.其中异常Exc ...

  9. Spring系列之——spring security

    1 搭建springboot 2 配置pom依赖(springboot版本为2.1.3) <dependency> <groupId>org.springframework.b ...

  10. 线程池ThreadPoolExecutor使用原理

    本文来源于翁舒航的博客,点击即可跳转原文观看!!!(被转载或者拷贝走的内容可能缺失图片.视频等原文的内容) 若网站将链接屏蔽,可直接拷贝原文链接到地址栏跳转观看,原文链接:https://www.cn ...