为了账号安全,请及时绑定邮箱和手机立即绑定

HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

http://img1.sycdn.imooc.com//5944d4750001be1208790099.jpg

添加

<init-param>

        <param-name> flushMode </param-name>

   <param-value>AUTO </param-value>        

        </init-param>

后没有作用

正在回答

4 回答

可以参考这里。http://blog.csdn.net/violet_echo_0908/article/details/51084884

0 回复 有任何疑惑可以回复我~

@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)

在service类开头加上这句,也行,尽管readOnly的默认值为false

0 回复 有任何疑惑可以回复我~

<!-- 定义事务管理 -->
 <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory"/>
 </bean>
 
 <!-- 通过<tx:advice>标签定义事务增强,并指定事务管理器 -->
 <tx:advice id="txAdvice" transaction-manager="txManager">
  <!-- 定义属性,声明事务规则 -->
  <tx:attributes>
   <tx:method name="*findAll*" read-only="true"/>
   <tx:method name="*save*" propagation="REQUIRED"/>
    <tx:method name="*delete*" propagation="REQUIRED"/>
     <tx:method name="*update*" propagation="REQUIRED"/>
  </tx:attributes>
 </tx:advice>
 
 <!-- 定义切面 -->
 <aop:config>
  <!-- 定义切入点 -->
  <aop:pointcut expression="execution(* com.jbit.service.*.*(..))" id="serviceMethod"/>
  <!-- 将事务增强与切入点组合 -->
  <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
 </aop:config>

0 回复 有任何疑惑可以回复我~

需要配置事务管理器才行

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号