解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
来源:互联网 发布:淘宝店铺被投诉售假 编辑:程序博客网 时间:2024/06/05 09:45
解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker的方法:
错误描述:
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in
read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove
'readOnly' marker from transaction definition.
存在的问题:
只读模式下(FlushMode.NEVER/MANUAL)写操作不被允许:把Session改成FlushMode.COMMIT/AUTO(可以解决)
或者清除事务定义中的readOnly标记(清除readOnly标记有时不管用)
解决方法:
web.xml配置里添加
<!-- OpenSessionInView过滤器 -->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<!--设置bean的名字,如果为默认的sessionFactory则可以省略-->
<init-param> <!--可以省略-->
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<!--设置bean的初始化参数,如果为默认的单例默认则可以省略-->
<init-param><!--单例模式,可以省略-->
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<!--解决该问题的关键代码-->
<init-param>
<param-name>flushMode</param-name>
<param-value>AUTO</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
0 0
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definitio
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- [SSH] Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly'
- 报错原因 (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker fr
- spring出现 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marke问题
- Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly
- Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly
- Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly
- g++和gcc
- 【Java学习笔记】——Statement & PrepareStatement
- 找资料总结1553B总线协议知识和HI-1575数据手册
- 关于python的一个问题
- 【设计模式】行为模式之Visitor访问者
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
- CSDN Markdown test
- 解析Java中的回调
- OC链式编程,一行代码写到黑!
- JSON 字符串 与 java 对象之间互相转换
- 关于单元测试
- 关于ajax跨域问题
- 32. Longest Valid Parentheses
- 【Java基础】——JDBC