/**
     *
     * 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. lucene源码分析(1)基本要素

    1.源码包 core: Lucene core library analyzers-common: Analyzers for indexing content in different langua ...

  2. ruby楼层排序问题

    求教楼层排序问题 要求正确楼层排序为: B2,B1,1F,2F,3F...10F,11F 现有这13个无序的楼层 怎么排列成上面的格式? 求教 luikore 1楼 , 19小时前 1人喜欢 sort ...

  3. Shell脚本编写4-----Shell 流程控制

    没啥好说的,直接从demo里看吧!(1) if 语句shell脚本的if语句格式如下: 判断输入两个参数的大小,执行结果如下 (2)for 循环for循环语法格式如下: 执行结果如下 (3)while ...

  4. SQL Server数据类型转换方法

    在SQL Server日常的函数.存储过程和SQL语句中,经常会用到不同数据类型的转换.在SQL Server有两种数据转换类型:一种是显性数据转换:另一种是隐性数据转换.下面分别对这两种数据类型转换 ...

  5. [C语言] 数据结构-逻辑结构和物理结构

    数据结构:相互之间存在一种或多种特定关系的数据元素的集合 1.数据结构分为逻辑结构和物理结构 集合结构:集合结构中的数据元素除了同属于一个集合外,他们之间没有其他关系 线性结构:线性结构中的数据元素之 ...

  6. Java生成xlsx格式的excel文件

    xlsx格式的写入的数据量据说有百万级,结合实际需要该格式. public static void main(String[] args) throws Exception { OutputStrea ...

  7. Spring系列之——使用了哪些设计模式

    1 工厂模式:BeanFactory.ApplicationContext创建中 2 模板模式:BeanFactory.ApplicationContext实现中 3 代理模式:在AOP实现中用到了J ...

  8. Java 中 List 和 数组之间的转换

    前言:在 java 开发过程中,经常会遇到数组和 list 互转的情况,这里记录一下,免得以后又去到处百度. 一.数组转为 LIST 这里转自 https://www.cnblogs.com/lius ...

  9. 中小型研发团队架构实践八:分布式协调服务ZooKeeper

    一.ZooKeeper 是什么 Apache ZooKeeper 由 Apache Hadoop 的子项目发展而来,于 2010 年 11 月正式成为了 Apache 的顶级项目. ZooKeeper ...

  10. hexo的next主题个性化教程:打造炫酷网站

    看到有些next主题的网站很炫酷,那么是怎么配置的呢?接下来我会讲一讲如何实现一些炫酷的效果 主要有以下32种: 在右上角或者左上角实现fork me on github 添加RSS 添加动态背景 实 ...