I have a parent object which has a one to many relationship with an ISet of
child objects. When deleting a child object, *everything works fine*. But
when deleting a child object *and* adding a new child object in the same
transaction, the first child is not deleted.

I have the following in the parent object:

<set name="Pages" inverse="true" cascade="all-delete-orphan"
access="field.camelcase-underscore">
    <key column="ContentId" />
    <one-to-many class="DeveloperFusion.Domain.Entities.ContentPage,
DeveloperFusion.Domain, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
</set>

My code is as follows:

Content content = contentRepository.Get(1);
content.Pages.Clear();
//---
//If I un-comment this, everything works as expected
//NHibernateSession.Current.Flush();
//---
content.Pages.Add(new ContentPage("Some new title", 1, "Some content") });
NHibernateSession.Current.Update(content);
NHibernateSession.Current.Flush();

basically no delete statement is being executed for the page element that
has been removed. However, if I don't combine the adding and the deleting
(by uncommenting the Flush() statement) everything works fine.

What am I missing???

Thanks

James

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to