ヒベルナ:Write operations arnot allowed…)
環境spring+hibernate 3+struts
failed to lazinitiaze a collection of role:no session or session was closed
実験していくつかの解決方法を発見しました.
1、ペアの多い2つの列に対応するlazy=trueをlazy=falseに変更すればいいです.
2、検索にxxx.load(class,id)を使うとxxxになり、get(class,id)3はweb.xmlファイルに参加します.
failed to lazinitiaze a collection of role:no session or session was closed
実験していくつかの解決方法を発見しました.
1、ペアの多い2つの列に対応するlazy=trueをlazy=falseに変更すればいいです.
2、検索にxxx.load(class,id)を使うとxxxになり、get(class,id)3は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>
<!-- -- <init-param> :org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.mmg</url-pattern>
</filter-mapping>