我在web.xml中已经配置了如下:
<!--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
分享到:
- 2007-03-06 10:40
- 浏览 3497
- 评论(1)
- 论坛回复 / 浏览 (1 / 4183)
- 查看更多
相关推荐
NULL 博文链接:https://yanzhenwei.iteye.com/blog/1701164
OpenSessionInViewFilter个人学习总结
OpenSessionInViewFilter解决Web应用程序的问题
3,在web.xml中配置 spring 的 OpenSessionInView 过滤器(解决抛LazyInitializationException的问题) 1,配置 <!-- 配置 spring 的 OpenSessionInView 过滤器 --> <filter-name>OpenSessionInView ...
SSH项目整合示例【OpenSessionInView】所用到的jar包 包含Struts + Hibernate + Spring所有jar及其依赖的jar
struts2.0.8+spring2.0+hibernate3.2 jar包
Hibernate 配置 数据库实体必须设置以下注解 @Entity @Id 自增主键必须设置以下注解,否则报错 @GeneratedValue(strategy = GenerationType.IDENTITY) 在更新或删除数据时,必须调用getHibernateTemplate().flush();...
如:在使用Java中得SSH框架时,我们需要在web.xml文件中配置编码的filter,具体代码是: <span xss=removed><!-- 表单处理乱码,必须在OpenSessionInViewFilter的filter之前 --> <filter>CharacterFilter ...
该案例实现了一个简单的登录功能,但里面将S2SH集成的所有配置信息都添加进去了。 如,OpenSessionInViewFilter、声明式事务、三层等等
课程内容 面向接口(抽象)编程的概念与好处 IOC/DI的概念与好处 inversion of control dependency injection AOP的概念与好处 ...opensessionInviewfilter(记住,解决什么问题,怎么解决) Spring JDBC
Spring4.0、Struts2.3.15、Hibernate4.2.4、jQuery1.9.1涉及到了诸多开发时的细节:ModelDriven、Preparable 拦截器、编写自定义的类型转换器、Struts2 处理 Ajax、OpenSessionInViewFilter、迫切左外连接、Spring ...
OpenSessionInViewFilter OpenSessionInViewInterceptor OpenSessionInViewInterceptor OptimisticLockingFailureException OptionsTag OptionTag OptionWriter OracleLobHandler OracleLobHandler....