How are you deleting, can you post the code?
RP
On Wednesday, November 19, 2014 7:29:44 AM UTC, pasquale wrote:
>
> I have a parent-childs relation as described under:
>
> public class Parent {
> ...
> IList<Child> _childs = new List<Child>();
> public virtual IEnumerable<Child> Childs {
> get { return _childs.AsEnumerable<Documento>(); }
> }
> ...
> }
>
> The related mapping is bidirectional:
>
> class ParentMap
> : ClassMapping<Parent > {
>
> ...
>
> Bag(x => x.Childs, cm => {
> cm.Inverse(true);
> cm.Access(Accessor.NoSetter);
> cm.Lazy(CollectionLazy.Lazy);
> cm.Key(key => {
> key.Column(map => map.Name("idproductcard"));
> key.NotNullable(true);
> key.OnDelete(OnDeleteAction.Cascade);
> });
> cm.OrderBy("absoluteposition asc");
> cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
> }, m =>
> {
> m.OneToMany(otm => otm.Class(typeof(Child)));
> });
>
> ...
> }
>
> class ChildMap
> : ClassMapping<Child> {
> ...
> ManyToOne<Parent>("Owner", map => map.Column("idproductcard"));
> ...
> }
>
> The idproductCard column in Child table isn't nullable.
> The problem is that all works fine excepts for deletion: when I perform
> a deletion, the childs data arent'deleted from db.
>
> If I change db column from not-nullable to nullable, also deletion works
> fine... in my real case I can't change this column due to legacy db.
>
> Why I can't removes child records? Maybe because the column isn't
> nullable and NH can't orphaned the records? Then key.NotNullable(true)
> in the mapping is skipped?
> I need to invoke manually deletion of this childs collection?
> I'm still on 4.0.0.4000.
>
> Thanks in advance.
>
>
--
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 http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.