当前位置: 代码迷 >> Java Web开发 >> id to load is required for loading解决方法
  详细解决方案

id to load is required for loading解决方法

热度:587   发布时间:2016-04-17 14:47:18.0
id to load is required for loading
我在用webwork+spring+hibernate开发web网站时,
出现如下错误,找不到原因。望高人指点:
java.lang.IllegalArgumentException:   id   to   load   is   required   for   loading
org.hibernate.event.LoadEvent. <init> (LoadEvent.java:51)
org.hibernate.event.LoadEvent. <init> (LoadEvent.java:33)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:796)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
edu.mudoll.dao.impl.DepartmentDAO.getDepartmentByDepartmentid(DepartmentDAO.java:24)
edu.mudoll.service.impl.DepartmentService.getDepartmentByDepartmentid(DepartmentService.java:23)
edu.mudoll.action.DepartmentAction.aboutDepartment(DepartmentAction.java:34)


------解决方案--------------------
departmentDAO中的getDepartmentByDepartmentid方法:
public Department getDepartmentByDepartmentid(Integer departmentid){
Session session = getSession();
Department department = (Department)session.get(Department.class, departmentid);
session.close();
return department;

}
  相关解决方案