/**
     *
     * 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. px、pt和em的区别

    (转载)http://www.1z1b.com/one-blog-a-week/px-em-pt/ 这里引用的是Jorux的“95%的中国网站需要重写CSS”的文章,题目有点吓人,但是确实是现在国内网 ...

  2. Mongodb添加副本及修改优先级

    Mongodb添加副本及修改优先级 1.添加副本集 #在primary节点上执行 >rs.add( { host: "192.168.1.11:27017", priorit ...

  3. puts,p,print的区别

    共同点:都是用来屏幕输出的. 不同点: puts 输出内容后,会自动换行(如果内容参数为空,则仅输出一个换行符号):另外如果内容参数中有转义符,输出时将先处理转义再输出 p 基本与puts相同,但不会 ...

  4. sqlserver中利用Tran_sql把逗号分隔的字符串拆成临时表

    在与数据库交互的过程中,我们经常需要把一串ID组成的字符串当作参数传给存储过程获取数据.很多时候我们希望把这个字符串转成集合以方便用于in操作. 有两种方式可以方便地把这个以某种符号分隔的ID字符串转 ...

  5. Ionic CLI 升级到最新版本

    由于Ionic 自身也在不停的更新当中, 所以开发者经常会遇到从官方的CLI 命令,在命令行窗口中执行出错的情况. 就比如我一个月之前安装的ionic 2.2.2版本,已不能使用最新的3.2.0 CL ...

  6. Jquery ui draggable在chrome和ie7下的bug

    当页面足够长,向下滚动一些之后, 在拖动时,被拖动的div会向下产生滚动距离那么高(scrolltop)的差距 鼠标位置距div顶部差距了正好页面scroll的距离,页面scoll越多差的越多. 解决 ...

  7. 如何移动 nuget 缓存文件夹

    本文告诉大家如何移动 nuget 缓存文件夹. 因为 nuget 文件夹一般比较大,现在我的 nuget 文件夹有 10 G,默认的 nuget 文件夹是在C盘,所以需要移动他. 可以使用下面的代码查 ...

  8. 撩课-Web大前端每天5道面试题-Day19

    1.实现一个函数clone,可以对JavaScript中的5种主要的数据类型(包括Number.String.Object.Array.Boolean)进行值复制 考察点1:对于基本数据类型和引用数据 ...

  9. [LeetCode]Flatten Binary Tree to Linked List题解(二叉树)

    Flatten Binary Tree to Linked List: Given a binary tree, flatten it to a linked list in-place. For e ...

  10. 基于 vue+element ui 的cdn网站(多页面,都是各种demo)

    前言:这个网站持续更新中...,有网上预览,github上也有源码,喜欢记得star哦,欢迎留言讨论. 网站地址:我的个人vue+element ui demo网站 github地址:yuleGH g ...