Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or r

 引自:http://wiflish.javaeye.com/blog/70148 在web.xml文件中配置OpenSessionInViewFilter hibernateFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 在spring的事务配置中: 这样的配置,当在容器中通过action调用service代码保存对象时,不能成功保存对象, 同时出现如下类似错误: Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. 这时修改filter的配置,增加如下代码: hibernateFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter singleSession false 这样就能成功保存对象了。 ================================================= 注: 回复中的下面问题暂时没有验证: 这种配置是有问题的。。 Xml代码 singleSession false 配置这个参数,就将OpenSessionInViewFilter的功能给去掉了。。。

你可能感兴趣的:(spring,xml,session,service,filter,action)