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;
}