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

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

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. Laravel Homestead的安装和使用(照搬)

    原文:https://blog.csdn.net/woqianduo/article/details/81091154/ 1.简介 1.1.Homestead是什么 Laravel Homestead ...

  2. proposal_layer.py层解读

    proposal_layer层是利用训练好的rpn网络来生成region proposal供fast rcnn使用. proposal_layer整个处理过程:1.生成所有的anchor,对ancho ...

  3. android-async-http框架库使用基础

    开源项目链接 android-async-http仓库:git clone https://github.com/loopj/android-async-http android-async-http ...

  4. getQueryString(option)的用法

    //页面参数接收1.function getQueryString(name) { var reg = new RegExp("(^|&)" + name + " ...

  5. 洛谷——P2613 【模板】有理数取余

    P2613 [模板]有理数取余 读入优化预处理 $\frac {a}{b}\mod 19620817$ 也就是$a\times b^{-1}$ $a\times b^{-1}\mod 19620817 ...

  6. [笔记] APIO 2018 Day1

    计算折纸 computaional origami 全息算法(???) margulis napkin problem 素数里有任意长的等差数列 xor gate Σxi or gate(exact ...

  7. Jdk动态代理和CGLIB动态代理大比拼

    前言: 这2种动态代理算是老生常谈的吧,面试还是会经常问到的,下面做下分析: jdk动态代理: import java.lang.reflect.InvocationHandler; import j ...

  8. <input type="button" /> 和<input type="submit" /> 的区别

    <input type="button" /> 这就是一个按钮.如果你不写javascript 的话,按下去什么也不会发生.<input type="s ...

  9. Oracle 实现查询不区分大小写(设置数据库)

    转http://blog.csdn.net/shl7765856/article/details/7622756 查询数据的时候. SQL Server 默认 不区分大小写. 如果要区分,就要额外的设 ...

  10. Maximun product

    Given a sequence of integers S = {S1, S2, ..., Sn}, you shoulddetermine what is the value of the max ...