Well... tree things1) we must know the generator of SubArticle
2) don't use quoted names or use the NH syntax to quote a name
3) checkout the
Ghostbuster<http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.html>test

2008/10/22 Jan Limpens <[EMAIL PROTECTED]>

>
> By the way, I just created that testcase and it passed. I did not test
> my real bl classes, but those parts of it I thought that they could be
> broken. Hm. So I guess, I have to bring the tests back to my solution.
>
> Anyways, I LOVED that testcase setup in that test solution!
>
> On Wed, Oct 22, 2008 at 5:47 PM, Jan Limpens <[EMAIL PROTECTED]>
> wrote:
> >                <subclass name="SubArticle"
> >
>  discriminator-value="subarticle">
> >                        <many-to-one name="Parent"
> >
> class="Article"
> >
> access="field.camelcase"
> >
> column="[SubArticleParentArticleID]"/>
> >                </subclass>
> >
> >
> > On Wed, Oct 22, 2008 at 5:16 PM, Fabio Maulo <[EMAIL PROTECTED]>
> wrote:
> >> The mapping of the class "SubArticle" is ?
> >>
> >> 2008/10/22 Jan Limpens <[EMAIL PROTECTED]>
> >>>
> >>> Hi guys,
> >>>
> >>> I have a
> >>>                <subclass name="Product"
> >>>                        <set name="SubArticles"
> >>>                                         table="Articles"
> >>>                                         access="field.camelcase"
> >>>                                         cascade="all-delete-orphan"
> >>>                                         inverse="true">
> >>>                                <key
> column="[SubArticleParentArticleID]"/>
> >>>                                <one-to-many class="SubArticle" />
> >>>                        </set>
> >>>                </subclass>
> >>>
> >>> do this:
> >>>
> >>>                public void AddSubArticle(int id, string name, string
> >>> description,
> >>> decimal price, int weight)
> >>>                {
> >>>                        var parent = prodDao.GetById(id);
> >>>                        parent.AddSubArticle(name, description, price,
> >>> weight); //
> >>> subarticle knows about it's parent here
> >>>                        prodDao.SaveOrUpdate(parent);
> >>>                        prodDao.CommitChanges();
> >>>                }
> >>>
> >>> and get a
> >>>
> >>> null id in SubArticle entry (don't flush the Session after an exception
> >>> occurs)
> >>>
> >>> This is quite by the book. What could I be making wrong?
> >>>
> >>> the log reads:
> >>>
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade -
> >>> processing cascade
> >>> NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for:
> >>> Product
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade - cascade
> >>> NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
> >>> collection: Product.SubArticles
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade - done
> >>> cascade NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction
> >>> for collection: Product.SubArticles
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade - deleting
> >>> orphans for collection: Product.SubArticles
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade - done
> >>> deleting orphans for collection: Product.SubArticles
> >>> 2008-10-22 16:50:16,086 [4] INFO  NHibernate.Engine.Cascade - done
> >>> processing cascade
> >>> NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for:
> >>> Product
> >>> 2008-10-22 16:50:16,086 [4] ERROR NHibernate.AssertionFailure - An
> >>> AssertionFailure occured - this may indicate a bug in NHibernate
> >>> NHibernate.AssertionFailure: null id in SubArticle entry (don't flush
> >>> the Session after an exception occurs)
> >>>
> >>>
> >>> --
> >>> Jan
> >>> ___________________
> >>> [EMAIL PROTECTED]
> >>> www.limpens.com
> >>> +55 (11) 3082-1087
> >>> +55 (11) 3097-8339
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Fabio Maulo
> >>
> >> >>
> >>
> >
> >
> >
> > --
> > Jan
> > ___________________
> > [EMAIL PROTECTED]
> > www.limpens.com
> > +55 (11) 3082-1087
> > +55 (11) 3097-8339
> >
>
>
>
> --
> Jan
> ___________________
> [EMAIL PROTECTED]
> www.limpens.com
> +55 (11) 3082-1087
> +55 (11) 3097-8339
>
> >
>


-- 
Fabio Maulo

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