我拥有恩赫特-马皮特:
<class name="Activity" table="Activity" lazy="false" >
<cache usage="read-write"/>
<id name="Id" column="Id" type="Guid">
<generator class="assigned"/>
</id>
<property name="Subject" column="Subject" type="String" length="255" />
<many-to-one name="ParentActivity" class="Activity" foreign-key="FK_Activity_ParentActivity" lazy="proxy" fetch="select">
<column name="ParentActivityId"/>
</many-to-one>
<set name="Activities" lazy="true" inverse="true" cascade="none" >
<key>
<column name="ParentActivityId"/>
</key>
<one-to-many class="Activity"/>
</set>
I have now an Entity Activity (x) which has another Entity Activity (y) set as ParentActivity. I am searching for the solution, that, when I delete the entity y, the reference from x to y is set to null. Now I become an error, that I cannot delete x because of the FK_Activity_ParentActivity. Can someone point me to the right way how I can do this? - Thanks.