0
我可以在我的HBM映射中执行以下操作吗?递归HBM映射
<class name="Employee" table="employees">
<!-- assume that each person only has exactly one supervisor -->
<many-to-one name="supervisor" class="Employee" column="supervisorId" />
</class>
当我使用上述HBM映射,我的服务器拒绝启动并出现以下错误:
org.hibernate.InstantiationException: could not instantiate test object Employee
Caused by: java.lang.StackOverflowError
at Employee.<init>(Employee.java:11)
at Employee.<init>(Employee.java:11)
at Employee.<init>(Employee.java:11)
...... (about a hundred duplicates)
线Employee.java的11只说:
public class Employee implements Serializable {
应该如何我建模我的主管 - 员工关系?主管没有专门的POJO,管理对象没有专门的领域。
是的,我的代码,准确的线。我将其更改为私人Employee supervisor = null,现在它可以工作。 – David 2011-05-03 16:27:33