I am using NHibernate 2.1.2.4000 with LinFu proxy generater and I have
the following problem.
Basically, I have a parent child mapping:
<class name="Parent">
<id name="Id">
<generator class="native" />
</id>
<property name="ChildCount" />
<set name="Children" inverse="true">
<key column="ParentId" />
<one-to-many class="Child" />
</set>
</class>
<class name="Child">
<id name="Id" column="Id">
<generator class="native" />
</id>
<property name="IsOpen"/>
<many-to-one name="Parent" column="ParentId" />
</class>
When I a child is added, deleted or the IsOpen flag changes, the
ChildCount must be updated. I do this in an interceptor. Creating or
deleting the child works perfectly, and the count gets correctly
updated. Changing the child, updating the ChildCount in the
OnFlushDirty interceptor method however does not work.
I've tried everything I could think of. In a few of my tries, I got an
exception in the transaction.Commit that the object could not be
reassociated because it had a dirty collection.
My current hypothesis is that NHibernate specifically disallows these
kinds of updated to e.g. prevent against circular references and never
ending cascade update cycles. If this is the case, does anybody have
an alternative to implement these kinds of cascade updates for cached
field values?
I'm quite out of ideas and would like some assistance.
--
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.