小弟刚学ssh没多久,做一个ssh的小运用当热手,但是使用spring管理事务之后,批量操作删除的时候,却报错:ERROR - Servlet.service() for servlet default threw exception
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' er from transaction definition在网上搜了下,发现应该改spring的getsession()和closesession()方法才行,但是spring的源码却找不到在哪个位置.
我应该怎么做呢,请大家指教?不胜感激!!!

解决方案 »

  1.   

    改spring文件当然可以,一般不需要改的
      

  2.   

    你执行的那个方法在事务提交特性里被配置为只读了去applicationContext.xml里看看<tx:advice/>标签里配置的方法跟你自己要执行的对比一下
      

  3.   

    这个异常说的非常清楚了!
    楼主我晕。 如果这种小问题都要去改Spring的源码, Spring早就没人用了。
      

  4.   

     在applicationContext.xml 中设置一下
    'readOnly' 的属性。
      

  5.   

    是你做错了,干嘛得改spring的源文件,一把只读属性改为false,二在基类中加:super.getSession.setflushmode(flush.Auto);三,你事务配的方法名,却在你的切面没有类似的方法。