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