自由飞翔

我在仰望,java之上

统计

留言簿(2)

我关注的blog

阅读排行榜

评论排行榜

异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (转载)

  1. 转载:文章来源:http://lucky16.iteye.com/blog/673903

    此异常是由于Spring提供的Open Session In View而引起的。
    开启OpenSessionInViewFilter这个过滤器的时候FlushMode就已经被默认设置为了MANUAL,如果FlushMode是MANUAL或NEVEL,在操作过程中 hibernate会将事务设置为readonly,所以在增加、删除或修改操作过程中会出现该错误 
    <
    filter>  
  2.        <filter-name>hibernateFilter</filter-name>  
  3.        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>  
  4.           <init-param>  
  5.                <param-name>flushMode</param-name>  
  6.                <param-value>AUTO</param-value>  
  7.            </init-param> 
  8.        <init-param>  
  9.            <param-name>singleSession</param-name>  
  10.            <param-value>true</param-value>  
  11.        </init-param>  
  12.    </filter>  
  13.    <filter-mapping>  
  14.        <filter-name>hibernateFilter</filter-name>  
  15.        <url-pattern>/*</url-pattern>  
  16.    </filter-mapping> 


Gavin

posted on 2011-10-21 11:38 GavinMiao 阅读(9852) 评论(2)  编辑  收藏 所属分类: 异常积累

评论

# re: 异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (转载)[未登录] 2016-05-18 10:32 gfh

dsfdgfdhgjhgfj  回复  更多评论   

# re: 异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (转载) 2016-05-29 20:29 詹超涵

Web.xml配了没用  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: