Hello everybody!
Consider the following situation:
Entity A has a collection of Entity B. But entity A actually doesn't know about that, b/c this relation is just defined in Entity B as a <many-to-one> relation.
But whenever I delete Entity A, I want to cascade the delete command!
How can this be achieved?
My first (and ugly) approach is to define a private field in Entity A:
Code:
private ICollection<B> bs;
which, of course, results in a warning that bs is never assigned.
and then define a property in the A.hbm.xml:
Code:
<set name="bs" access="field" lazy="true" cascade="all">
<key column="typeId" />
<one-to-many class="B" />
</set>
How would you solve this problem??
Thx in advance & kind regards
Marks