Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
来源:互联网 发布:免费套料软件 编辑:程序博客网 时间:2024/05/15 04:55
org.springframework.dao.InvalidDataAccessApiUsag
问题:只读模式下(FlushMode.NEVER/MANUAL)写操作不被允许:把你的Session改成FlushMode.COMMIT/AUTO或者清除事务定义中的readOnly标记。
错误原因:
解决方法:
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> // 。。。。<filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern></filter-mapping>如果在交给spring 管理的情况下,在beans.xml 里的配置
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <aop:config> <aop:pointcut id="bussinessService" expression="execution(* com.fan.service.base.*.*(..))" /> <aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="get*" read-only="false" propagation="NOT_SUPPORTED"/> <tx:method name="find*" read-only="false" propagation="NOT_SUPPORTED"/> <tx:method name="save*" propagation="REQUIRED"/> // 如果不把save update delete都配置上, <tx:method name="update*" propagation="REQUIRED"/> //这些操作会无效 <tx:method name="delete*" propagation="REQUIRED"/> </tx:attributes> </tx:advice>
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允许
- 整合SSH时,进行save操作报错Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作
- 错误:Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into
- 错误:Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)..
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)..
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)
- C# 鼠标拖动WinForm无边框窗口
- Unity3D引用dll打包发布的问题及解决
- 结构体继承自结构体 .
- 以太网帧格式
- apache做反向代理服务器
- Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
- 使用Apache做负载均衡
- keepalived 软件简介
- 大型网站架构演变和知识体系
- MySQL索引的创建、删除和查看
- MySQL视图的创建、修改与删除
- STUN和TURN技术浅析【转载】
- windows下Memcached 架设及java应用
- Android检测系统中是否存在某进程