hibernate整合spring异常处理
来源:互联网 发布:mac如何解密外置硬盘 编辑:程序博客网 时间:2024/06/08 01:20
在spring整合hibernate是初学者会遇到这样一个问题:
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
这是这是因为没有配置事务管理器:
在beans.xml文件,即spring 配置文件中对事务管理器进行配置如下:
<!--1.配置事务管理器--><bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/></bean><!--2.开启事务注解--><tx:annotation-driven transaction-manager="hibernateTransactionManager"/>
同时在Action调用的service层类名上加上注解:@Transactional
阅读全文
0 0
- hibernate整合spring异常处理
- myeclipse下整合 spring hibernate struts 异常的处理.
- hibernate 和spring整合常见异常
- spring整合hibernate时的getHibernateTemplate()异常
- Hibernate 和 spring 整合异常 org/objectweb/asm/Type异常
- spring spring mvc hibernate整合遇到的异常
- Spring管理Hibernate事务出现异常处理
- spring, hibernate 事物处理,异常拦截
- JDK6+Tomcat6+MyEclipse6,整合Struts,Spring,Hibernate出现异常
- 整合Spring与Hibernate 异常 Unable to instantiate default tuplizer
- 关于spring整合hibernate 懒加载异常解决方案
- 整合hibernate和spring框架测试事物出现的异常
- SSH框架:Spring和hibernate整合时出现的异常
- Spring:Spring整合Hibernate
- 【Spring】Spring+hibernate整合
- spring整合hibernate 关于大数据缓存处理
- struts整合spring整合hibernate
- spring 整合hibernate整合方式
- jq绑定事件方法及区别
- Ubuntu上使用gensim计算文档间的相似度
- 常见的垃圾收集器
- HDU 1806 Frequent values(线段树+离散化+二分)
- vector用法
- hibernate整合spring异常处理
- AudioService
- Docker网络基础-yellowcong
- 集合框架——定义泛型接口
- mysql索引实例----第二章实战篇
- Android APK安装过程
- 回文串类型题目集锦
- 【iOS】TestFlight 发布包测试
- 关于fork一些有意思的问题