Write operations are not allowed in read-only mode

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

你可能感兴趣的:(SSH)