浏览 4263 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-03-06
<!--OpenSessionInViewFilter配置--> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>singleSession</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 但是为什么hibernate配置lazy="true" 的时候,还是提示: 2007-03-06 10:34:52,562 ERROR [org.hibernate.LazyInitializationException] - failed to lazily initialize a collection of role: com.hl3000.dblogic.DAO.POJO.PermModuledefine.permissions - no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.hl3000.dblogic.DAO.POJO.PermModuledefine.permissions - no session or session was closed 是我的那里配置还没弄好么? hibernate配置如下: <set name="permissions" inverse="true" lazy="true" order-by="PERMISSION_ID"> <key column="MODULE_ID" /> <one-to-many class="com.hl3000.dblogic.DAO.POJO.PermPermissiondefine" /> <many-to-one name="module" column="MODULE_ID" class="com.hl3000.dblogic.DAO.POJO.PermModuledefine" /> 参考: http://blog.csdn.net/nimeimei/articles/480646.aspx 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-03-06
解决方法:
struts-config.xml <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext_action.xml" /> </plug-in> 注意:这里只有applicationContext_action.xml web.xml <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext*.xml</param-value> </context-param> ......... <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> |
|
返回顶楼 | |