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