If we have two tables:
class Parent {
  public virtual int Id {get;set;}
  public virtual string Text {get;set;}
  public virtual IList<Child> Children {get;set;}
}

class Child {
  public virtual int Id {get;set;}
  public virtual Parent ParentObj {get;set;}
}

and next mapping:

public class ParentMapping : ClassMap<Parent>{
  public ParentMapping(){
    Map(x => x.Id).Unique().GeneratedBy.Identity();
    Map(x => x.Text);

    HasMany<Child >(x =>
x.Children ).AsBag().Not.LazyLoad().Cascade.AllDeleteOrphan();
  }
}

public class ChildMapping : ClassMap<Child> {
  public ChildMapping(){
    Map(x => x.Id).Unique().GeneratedBy.Identity();
    References<Parent>(x => x.ParentObj);
  }
}

and we will try to update ParentEntity Text field and save changes by
using  transaction and CurrentSession.SaveOrUpdate we will receive
cascade updating of all related entities in Child table.

WHY? There are no changes to Parent.Id field!!! Only to Parent.Text!!!
Why nHibernate (3.1) and fluentNHibernate (1.2) update related child
entries?

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