解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from
2016-11-11 23:26
549 查看
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标记。
解决方法:
web.xml配置里添加
<!-- OpenSessionInView过滤器 -->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<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>*.do</url-pattern>
</filter-mapping>
问题:只读模式下(FlushMode.NEVER/MANUAL)写操作不被允许:把你的Session改成FlushMode.COMMIT/AUTO或者清除事务定义中的readOnly标记。
解决方法:
web.xml配置里添加
<!-- OpenSessionInView过滤器 -->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<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>*.do</url-pattern>
</filter-mapping>
相关文章推荐
- 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
- [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 definitio
- 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
- 报错原因 (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker fr
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly'
- 两种方法解决Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
- 解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or rem
- 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
- Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly
- spring出现 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marke问题
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AU