Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' er from transaction definition.具体是一个SSH框架的商务网站,在页面操作数据后,更新不了数据库,Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' er from transaction definition.

解决方案 »

  1.   

    http://wiflish.javaeye.com/blog/70148
      

  2.   

    你的事务怎样写的?
    估计是事务问题再就是这里你怎样写的呢
    <filter>
    <filter-name>openSession</filter-name>
    <filter-class>
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
    </filter-class>
    <init-param>
    <param-name>flushMode</param-name>
    <param-value>AUTO</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>openSession</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
      

  3.   


    <bean id="namingTransactionAttribute" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
        <property name="properties">
          <props>
            <prop key="insert*">PROPAGATION_REQUIRED</prop>
            <prop key="create*">PROPAGATION_REQUIRED</prop>
            <prop key="update*">PROPAGATION_REQUIRED</prop>
            <prop key="save*">PROPAGATION_REQUIRED</prop>
            <prop key="del*">PROPAGATION_REQUIRED</prop>
            <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
          </props>
        </property>
    </bean>、
    是spring吗 上面这样的代码 你把你的 事务控制层的 方法名称 开头用 key 中的开头就可以了
      

  4.   

    你调用的方法不以 insert create update save del开头
      

  5.   

    直接修改opensessioninviewfilter过滤器的配置,配置过滤器的时候配置《filter>      《filter-name>openSession《/filter-name>      《filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter《/filter-class>      《init-param>          《param-name>flushMode《/param-name>          《param-value>AUTO《/param-value>      《/init-param>  《/filter>