错误与解决方案.docVIP

  • 0
  • 0
  • 约5.87千字
  • 约 6页
  • 2017-06-13 发布于湖北
  • 举报
failed to lazily initialize a collection of role: com.ccy.valueBean.Coustomer.accounts, no session or session was closed 解决方案: 1、设置lazy=false 如果是用annotation,则配置如下 @OneToMany( ???targetEntity = CourseAuthorizationItem.class, ???cascade = {CascadeType.PERSIST, CascadeType.MERGE}, ???mappedBy = course,?fetch=FetchType.EAGER ??) 将fetch类型设置成直接获取 2、就是使用filter,过滤所有的链接 如果在使用filter的时候,要配置事务处理,否则会导致session处于只读状态而不能做修改、删除的动作 web-app filter filter-namehibernateFilter/filter-name filter-class org.springframework.orm.hibernate.support.OpenSessionInViewFilter /filter-class /filter filter-mapping filter-n

文档评论(0)

1亿VIP精品文档

相关文档