Hi
Sorry for asking again about this particular topic, I see this has
come up many times already but I can't find a clear answer when
viewing the problem in this particular angle and sadly the NHibernate
documentation never finishes to confuse me.
Anyway, can I get a clear answer as to whether NHibernate supports
cascade deletion for objects that have been defined as "lifecycle
objects" (section 9.9, http://nhforge.org/doc/nh/en/index.html) when
there is a unidirectional relationship (only from Parent to Child, not
vice-versa)
For instance :
public class Parent
{
private IList<Child> _children = new List<Child>();
public IList<Child> Children {get {return _children;}}
}
public class Child
{
}
The <bag> element has been declared with cascade="all-delete-orphan"
but still when I delete the Parent the only thing that happens is that
the foreign-key column from Child table, which happens to be
referenced only in the <bag> element, is set to null.
<bag name="_children" access="field" cascade="all-delete-orphan"><key
column="Parent_Id" /><one-to-many class="Child" /></bag>
I was expecting NHibernate to iterate through all the items in the
collection and to pass the Delete command to all of them.
Am I missing something here ?
Cheers
Daniel Fernandes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---