0
错误:尝试从使用Hibernate的引用表中检索数据时出现问题。
org.hibernate.LazyInitializationException SEVERE: could not initialize proxy - the owning Session was closed
代码:
System.out.println(resultStudent.getStudentAddress().getCity());
这里getAddress()
返回Address
对象,我试图让城市使用Address
类的getCity()
的学生。为什么我会收到上述错误?
刚刚获取地址对象不会引发任何错误。