spring配置hibernate抛出read only 异常
来源:互联网 发布:百度大数据产品 编辑:程序博客网 时间:2024/06/06 18:31
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
根据异常提示可以判断,“只读”,说明当前方法并没有写入和修改的权限,
debug调试的时候会抛出反射包 java.lang.reflect 下的InvocationTargetException 异常,这个异常会
误导,其次这个异常涉及的太广泛,不易查找错误
解决办法:
需要在spring的配置文件中将事物只读设置为false或者涉及的方法定为"PROPAGATION_SUPPORTS"。
如下:
<tx:method name="涉及方法" read-only="false"/>
或者
<property name="transactionAttributes">
<props>
<prop key="涉及方法">PROPAGATION_SUPPORTS</prop>
</props>
</property>
<props>
<prop key="涉及方法">PROPAGATION_SUPPORTS</prop>
</props>
</property>
0 0
- spring配置hibernate抛出read only 异常
- 关于spring+hibernate的read-only mode
- spring事务中read-only配置
- spring配置hibernate添加数据save not allow in read-only mode
- Spring+Hibernate进行单元测试时出现read-only mode错误
- spring read-only理解
- hibernate saveOrUpdate抛出异常
- spring 声明式事务配置,抛出runtimeException异常不回滚
- spring 声明式事务配置,主动抛出异常不回滚
- Hibernate批量删除出现sql异常Connection is read-only. Queries leading ... are not allowed
- hibernate异常:Write operations are not allowed in read-only mode
- Hibernate批量删除出现sql异常Connection is read-only. Queries leading ... are not allowed
- spring 声明式事务异常 :Write operations are not allowed in read-only mode
- Spring+Hibernate报错:Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)
- hibernate异常:解决Hibernate的Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL):
- Android Read-only file system 异常
- springmvc hibernate事务管理read-only属性
- spring定时任务 Connection is read-only
- (三)Android布局之表格布局(TableLayout)
- BestCoder Round #28
- 伟厦绽辽缮翱蠢揽男敲
- 基于文档的MFC项目中 系统菜单设置check
- keystore creation
- spring配置hibernate抛出read only 异常
- 设置GridView的item为正方形
- 一个提高SQL Server操作效率的软件
- 开源控件收集
- 2015年软件开发的4大重要发展趋势
- 命名管道,read函数不阻塞的解决方法
- 解决Joomla登录后台时500-发生一个错误
- nyoj-325-zb的生日
- NYOJ 263 精 挑 细 选