I have successfully made a "composite pattern" mapping and I use "one table".
Everything works when I have 1 baseclass, 1 composite subclass, 1 leaf subclass.
But ...
When I try to subclass the composite subclass like this ( I just show the relevant things):
<CODE>
class CompositeA : Base { ... public virtual IList<Base>Children ... }
class CompositeB : CompositeA { ... public override IList<Base> Children ... }
<MAP>
<subclass name="CompositeA" discriminator-value="A"> <list name="Children" cascade="all-delete-orphan"> <key column="ParentId"/> <index column="ChildIndex"/> <one-to-many class="Base"/> </list> </subclass> <subclass name="CompositeB" discriminator-value="B"> </subclass>
Nhibernate does not complain in anyway and in memory everythingsfine though CASCADE does not work for Children of instances of CompositeB !!! If I explicit Save children of CompositeB instances before I put then in the list it works but that is not an option for med.
So the question HOW do I declare cascade="all-delete-orphan" for subclass CompositeB ?
If anyone know please help!
Regards Magnus
I
|