I have the same problem...
Do you find any solution?

Thanks

On Saturday, July 30, 2011 at 2:12:28 PM UTC-3, Adam Bar wrote:

> I have simple Parent-Child relationship, Parent has many Child 
> objects, the relation is bidirectional: 
>
> public class Parent 
> { 
>     public virtual int Id { get; protected set; } 
>     public virtual string Name { get; set; } 
>     public virtual IList<Child> Children { get; set; } 
> } 
>
> public class Child 
> { 
>     public virtual int Id { get; protected set; } 
>     public virtual string Name { get; set; } 
>     public virtual Parent Parent { get; set; } 
> } 
>
> Mapping for the relation sets cascade to AllDeleteOrphan to remove 
> Child objects not referenced by Parent any more and sets that relation 
> is inverse, to enable one-shot deletes as explained here: 
>
> http://www.nhforge.org/doc/nh/en/index.html#performance-collections-oneshotdelete
>  
>
> HasMany(x => x.Children).Cascade.AllDeleteOrphan().Inverse(); 
>
> And now I'm clearing the list of Child objects: 
>
> var parent = session.Get<Parent>(1); 
> parent.Children.Clear(); 
> session.Update(parent); 
>
> NHibernate deletes the Child object as expected, but it do this by 
> sending separate DELETE query for each Child from the collection: 
> DELETE FROM Child WHERE Id = ... - that can mean really LOT of 
> queries. 
>
> According to the docs mentioned, it should issue one DELETE using 
> foreign key, but it doesn't - I have multiple DELETEs by Child ID. Am 
> I missing something? 
>
> (NH 3.2.0)

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to