如果去掉的话.种类能查到. 但是我想查种类的勘误, 用这样的代码 Sort sort = (Sort) BusFacade.sortBus.getSort(Integer.parseInt(sortId)); Set set = sort.getErratas(); Iterator it = set.iterator(); List errList = new ArrayList(); while (it.hasNext()) { errList.add(it.next()); } request.setAttribute("errList", errList);这样也会报错. org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.daacc.dao.sort.Sort.erratas - no session or session was closed
但是我想查种类的勘误,
用这样的代码
Sort sort = (Sort) BusFacade.sortBus.getSort(Integer.parseInt(sortId));
Set set = sort.getErratas();
Iterator it = set.iterator();
List errList = new ArrayList();
while (it.hasNext()) {
errList.add(it.next());
}
request.setAttribute("errList", errList);这样也会报错.
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.daacc.dao.sort.Sort.erratas - no session or session was closed
把errata的hbm文件的lazy="false"去掉;增加cascade="save-update" outer-join="auto"
hashCode方法中包含了及联属性所致.
文档我也不知道哪有,自己搜索下吧