There is a separate set of listeners for collections. John Davidson
On Tue, Oct 26, 2010 at 2:54 PM, Kendrick Abell <[email protected]>wrote: > I'm trying to add an Audit function to my application, which is using > NHibernate 2.1.2. I've wired up an OnPreInsert event by implementing > the IPreInsertEventListener for my object, and then set the > LastUpdated and LastUpdatedBy fields in the event code. This works > when I create a new object and save it. The issue comes when I create > a new object, add a new child object to it, then save the parent. The > OnPreInsert event is fired for the parent object, but not for the > child, and I get a "not-null property references a null or transient > value" error from NHibernate when it validates the LastUpdatedBy field > in the child object. > > I haven't been able to find any definitive documentation on the entire > event lifecycle in NHibernate (i.e. insert, update, delete, and all > the bits in between) but if that exists; a link to it would help > immensely. > > So, my question is, where am I going wrong? Am I approaching this the > wrong way (given the more complex scenario of wanting to audit child, > grandchild, great grandchild, etc. objects as well) or have I likely > missed something in my code that is causing the events I think should > fire to be missed? > > Note that I've asked this question in much more detail on > StackOverflow, but I find the NHibernate questions tend to get buried > on there. Thus, I'm cross posting to this list and will deal with > synchronizing any answers between the two sites. My question on SO > can be found here: > http://stackoverflow.com/q/4026578/142129 > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
