遇到这个问题之前,我去百度和谷歌去搜索了一下。发现各种说法。可是针对我的项目而言,也就是公司的项目而言,这个问题的根源并不是是网上所说的那样。

最后是通过自己的想法做測试得到了解决。

1.首先说说我的配置吧。我的配置是通过spring自带的注解来实现 声明式事物管理的。假设我们没去了解spring的声明式事物管理的话,也许我们是得不出什么结论的。

假设你配置过声明式事物管理,你就知道spring是怎么帮你管理的。

2.spring声明式事物管理是在service层管理的,关于到sessionFactory.getCurrentSession()的使用时,是具备有tx(Transactional),全部我们必须在service层中进行@Transactional注解,而不能够再dao层或者其它层进行事物的管理。这也是使用注解方式的声明式事物管理的缺点。

3.spring默认的声明式事物管理的是在service层中(注解方式),假设你採用xml方式进行声明式事物管理的话。能够配置你先要声明式事物管理的形态。

org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not的更多相关文章

  1. org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

    org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a ...

  2. spring事务管理出错。No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy ...

  3. No Hibernate Session bound to thread, and configuration does not allow creat

    No Hibernate Session bound to thread, and configuration does not allow creat 今天遇到这么一个错误,在网上差了很多都没有能解 ...

  4. spring 管理事务配置时,结果 报错: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here这个异常

    java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not al ...

  5. 解决No Hibernate Session bound to thread, and configuration does not allow creat。。。

    applicationContext.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans ...

  6. org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a

    如果出现了这个错误,看看在使用Hibernate的时候有没有在事务的环境下执行操作!

  7. 出现No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here异常

    问题描述: public void save(BaseEntity baseEntity) { Session session = null; try { session = currentSessi ...

  8. 报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

    大概分析一般使用了注解才会报这方面的错 1.没有在spring的ApplicationContext.xml中开启注解事务 <!-- 开启注解事务 --> <tx:annotatio ...

  9. No Hibernate Session bound to thread, and configuration does not allow

    今天晚上挺悲催的,遇到了这个问题花费我很长时间,现在总结如下: 到这这种情况的发生有两种情况: 1,没有配置事物只要在Spring配置文件中添加如下代码: <bean id="txMa ...

随机推荐

  1. Windos无法验证文件数组签名

    参考链接:https://jingyan.baidu.com/article/09ea3ede6982c4c0aede39e6.html Windows无法验证文件数字签名而无法启动,照以下去做,可以 ...

  2. D2. Toy Train

    D2. Toy Train time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  3. OBJECTPROPERTY用法整理

    OBJECTPROPERTY用法整理 分类: 系统表与表结构 数据库管理维护2010-06-03 16:37 2783人阅读 评论(1) 收藏 举报 数据库sql serverinsertobject ...

  4. vue-cli项目中使用mockjs(基础使用和全局配置使用)

    参考:vue+mockjs 模拟数据,实现前后端分离开发 (Github-Demo可查看全部代码),Mockjs ,Axios 很多时候前后端分离的项目在开发过程中前端所需数据和后端接口并不会同步开发 ...

  5. 题解 洛谷P1903/BZOJ2120【[国家集训队]数颜色 / 维护队列】

    对于不会树套树.主席树的本蒟蒻,还是老老实实的用莫队做吧.... 其实这题跟普通莫队差不了多远,无非就是有了一个时间,当我们按正常流程排完序后,按照基本的莫队来,做莫队时每次循环对于这一次操作,我们在 ...

  6. eclipse之版本代号

  7. 零基础入门学习Python(4)--改进我们的小游戏

    前言 在以前的博客中有做个一个小游戏,但是太简单了,所以这次就来对我们做的小游戏进行改进,改善从以下四个方面进行: 程序猜错的时候要给出提示,例如告诉用户输入的值是大了还是小了. 以前程序每运行一次只 ...

  8. virtualbox虚拟机桥接方式网络设置

    一.编辑网卡 cd   /etc/sysconfig/network-scripts 查看本地win10ip及子网掩码: 如果查看到的ip不是192开头的,可以手动设置为192开头的ip 2.设置虚拟 ...

  9. layuiAdmin 项目修改

    layuiAdmin修改 index.js 修改登录url user/login=>publics/login config.js 修改 name 项目名称, tokenName token字段 ...

  10. 洛谷 3871 [TJOI2010]中位数

    [题解] 平衡树模板题,不过因为可以离线,所以有别的做法.把询问倒着做,变成删掉数字.求中位数,于是可以二分+树状数组. #include<cstdio> #include<cstr ...