首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

处理懒加载有关问题后出现的有关问题:Write operations are not allowed in read-only mode (FlushMode.

2012-11-23 
处理懒加载问题后出现的问题:Write operations are not allowed in read-only mode (FlushMode.NEVE进行懒

处理懒加载问题后出现的问题:Write operations are not allowed in read-only mode (FlushMode.NEVE

进行懒加载处理后增加数据出现的问题: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。

Web.xml配置如下:

<filter>?
??? <filter-name>hibernateFilter</filter-name>?
??? <filter-class>?
??????? org.springframework.orm.hibernate3.support.OpenSessionInViewFilter?
??? </filter-class>?
???? <init-param>?
??????? <param-name>singleSession</param-name>?
??????? <param-value>false</param-value>?
??? </init-param>?
</filter>?
<filter-mapping>?
??? <filter-name>hibernateFilter</filter-name>?
??? <url-pattern>/*</url-pattern>?
</filter-mapping>?

?

出现上面的情况是因为之前Web.xml中没有这个

<init-param>?
??????? <param-name>singleSession</param-name>?
??????? <param-value>false</param-value>?
?</init-param>

?

?

或者是把false设置为true:

<init-param>?
??????? <param-name>singleSession</param-name>?
??????? <param-value>true</param-value>?
?</init-param>

热点排行