异常:getHibernateFlushMode is not valid without active transaction; nested exception is org.hibernate.HibernateException: getHibernateFlushMode is not valid without active transaction getHibernateFlu
场景:
在使用spring整合hibernate调用的HibernateTemplate时报错
解决:
在spring配置文件中添加事务的配置
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<!-- 注入sessionFactory,配置sessionFactory -->
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="txAdvice" transaction-manager="hibernateTransactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="personServiceOperation" expression="execution(* user.service.UserServiceImpl.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="personServiceOperation" />
</aop:config>
异常:getHibernateFlushMode is not valid without active transaction; nested exception is org.hibernate.HibernateException: getHibernateFlushMode is not valid without active transaction getHibernateFlu的更多相关文章
- Exceprtion:e createQuery is not valid without active transaction; nested exception is org.hibernate.HibernateException: createQuery is not valid without active transaction
如果增加配置了current_session_context_class属性,查询的时候需要session.beginTrasaction()来开启事务
- org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open con
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session f ...
- Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep linux下mysql修改连接超时wait_timeout修改后就ok了
Linux下mysql修改连接超时wait_timeout 1,首先: show variables like '%timeout%': 显示结果: +------------------------ ...
- Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnection
Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnec ...
- spring整合hibernate的时候报异常org.hibernate.HibernateException: createQuery is not valid without active transaction
在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is n ...
- org.hibernate.HibernateException: getFlushMode is not valid without active transaction
Spring & Hibernate 整合异常记录: org.hibernate.HibernateException: getFlushMode is not valid without a ...
- Exception in thread "main" org.hibernate.HibernateException: save is not valid without active transaction
在spring4+hibernate4整合过程中,使用@Transactional注解事务会报"Exception in thread "main" org.hibern ...
- Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Cannot open connection
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceE ...
- 【错误】:Could not open JDBC Connection for transaction; nested exception is: Communications link failure;The last packet sent successfully to the server was 1 milliseconds ago
# #错误日志 2016-11-10 16:19:20,834 ERROR [org.quartz.core.JobRunShell] - Job DEFAULT.jobtask threw an u ...
随机推荐
- 【CF429E】 Points and Segments(欧拉回路)
传送门 CodeForces 洛谷 Solution 考虑欧拉回路有一个性质. 如果把点抽出来搞成一条直线,路径看成区间覆盖,那么一个点从左往右被覆盖的次数等于从右往左被覆盖的次数. 发现这个性质和本 ...
- Java的简单类型不能够精确的对浮点数进行运算
由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精确的浮点数运算,包括加减乘除和四舍五入. import java.math.BigDecimal; /** * 由于Java的简单类 ...
- 数据结构(二): 轻量级键值对 SparseArray
SparseArray是Android framework中提供的轻量级的键值对数据结构,我们知道空间和效率从来都是相悖的,SparseArray的实现正是以时间来换取空间效率,适合小规模数据的存储. ...
- Javascript高级编程学习笔记(66)—— 事件(10)变动事件
变动事件 DOM2级的变动事件,能在DOM中的一部分发生变化时给出提示 变动事件是为XML或HTML DOM 设计的,并不特定于某种语言 DOM2级定义了如下变动事件: DOMSubtreeModif ...
- 4.TableLayout、回调接口
会话详情页 listview条目布局 列,当第0列的内容过多时,不至于将其他列的内容,挤出屏幕 --> <TableLayout android:id="@+id/tl_rece ...
- jQuery.extend(object)
为jQuery类添加类方法,可以理解为添加静态方法. jQuery.extend({ min: function(a, b) { return a < b ? a : b; }, max: f ...
- Spring 实现事务的三种方式
事务:保证数据的运行不会说A给B钱,A钱给了B却没收到. 实现事务的三种方式(重要代码): 1.aspectJ AOP实现事务: <bean id="dataSourceTransac ...
- Python档案袋( 时间 和 随机数 模块 )
时间模块 #导入必要模块 import time #获取时间戳 print(time.time()) #输出:1547651016.03502 #格式化时间元组 # 参数可传递自定义的时间戳,如:ti ...
- 在vue 中使用 less
1.安装 npm install --save-dev less less-loader npm install --save-dev style-loader css-loader 先在index. ...
- No principal was found in the response from the CAS server
按网上的配置了 public String casServerUrlPrefix = "http://cas-server.com:8080/cas"; public String ...