Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
来源:互联网 发布:mac下redis可视化工具 编辑:程序博客网 时间:2024/05/29 07:40
使用openSessionViewFilter经常出现的一个错是【Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.】
原因大致是:这个拦截器会延迟session的关闭,当你在请求后如果执行一个查询语句然后再执行修改语句这样就会出现这个错误,因为在执行查询的时候openSessionViewFilter会把你查询设置为只读模式FlushMode.NEVER(这是它的默认,表示不会把你的数据与数据库进行同步),这是解决方法
(1)有配置事务;
(2)web.xml配置里添加
<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>
- 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 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 definition
- 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 definitio
- [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
- 解决 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
- 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
- 利用jQuery的$.event.fix函数统一浏览器event事件处理的差异
- 【ACM入门一】1002 HDU 2021
- Arm-Linux程序开发扫盲
- Create AD User, User must change password at next logon
- andriod数据库的开发
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition
- c#批量建立用户
- IT的老兵:我们缺什么
- Android的string.xml中使用html与变量
- 主题:Android 内存泄漏调试(转)
- JDBC事务处理机制探秘
- android string.xml %问题。
- C#事件(event)解析
- 给IT新人的15点建议:苦逼程序员的辛酸反省与总结