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

异常积累: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

你可能感兴趣的:(异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode )