Message from discussion Clarification on NH-2596 of PreUpdate vs OnSaveOrUpdate semantics
Received: by 10.224.196.2 with SMTP id ee2mr95813qab.19.1302229832745;
Thu, 07 Apr 2011 19:30:32 -0700 (PDT)
Received: by 10.224.207.201 with SMTP id fz9ls405201qab.3.p; Thu, 07 Apr 2011
19:30:27 -0700 (PDT)
Received: by 10.224.9.14 with SMTP id j14mr83265qaj.12.1302229827894; Thu, 07
Apr 2011 19:30:27 -0700 (PDT)
Received: by w36g2000vbi.googlegroups.com with HTTP; Thu, 7 Apr 2011 19:30:27
Date: Thu, 7 Apr 2011 19:30:27 -0700 (PDT)
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0,gzip(gfe)
Subject: Re: Clarification on NH-2596 of PreUpdate vs OnSaveOrUpdate semantics
From: Suman <sumanre...@gmail.com>
To: nhusers <email@example.com>
Content-Type: text/plain; charset=windows-1252
In my case, There is always some update on subclass.
I haven't tested it the exact scenario that you've mentioned but yeah
seems like it's still an issue.
On Apr 6, 5:42=A0pm, Scott Findlater <scottfindla...@gmail.com> wrote:
> Hi Suman,
> I would be interested to know if you are updating any other properties
> in your subclass, that after removing dynamic-update=3Dtrue, all works.
> This is because if I update a property on the subclass then any
> processing in the PreUpdate event is persisted, but if the subclass is
> only modified in the PreUpdate event then nothing is persisted.
> On Apr 6, 7:58=A0am, Suman <sumanre...@gmail.com> wrote:
> > Hi Scott,
> > I have similar issue and I was about to ask the same question here.
> > Further to your situation, I am not sure whether it's a bug or
> > feature, In my mapping, when I have dynamic-update =3D "true" in
> > subclass the audit columns in base class, the generated sql doesn't
> > include audited column (ModifiedBy & ModifiedDate which are properties
> > of base class) but if I remove dynamic-update =3D "true" it works. So
> > essentially it points me to some reflection + dynamic-update issue.
> > Just wondering if that's what's happening in your side as well.
> > Suman
> > On Apr 5, 6:27=A0pm, Scott Findlater <scottfindla...@gmail.com> wrote:
> > > Please may I ask for clarification on the semantics/ usage of
> > > PreUpdate vs OnSaveOrUpdate listeners based on NH-2596 (http://
> > > 126.96.36.199/browse/NH-2596).
> > > After reading Ayende's blog posts on NHibernate
> > > IPreUpdateEventListener & IPreInsertEventListener (http://ayende.com/
> > > Blog/archive/2009/04/29/nhibernate-ipreupdateeventlistener-amp-
> > > ipreinserteventlistener.aspx) with an audit trail example I adopted
> > > this method myself. =A0During my learning I raised NH-2617 (http://
> > > 188.8.131.52/browse/NH-2617) issue, where I found PreUpdate event
> > > data changes on an entity which is only modified in the PreUpdate
> > > event is not persisted.
> > > My issue was closed as a duplicate of NH-2596. =A0However, NH-2596 is
> > > also closed as =93not an issue=94 with the solution to use the
> > > OnSaveOrUpdate event listeners on the basis that pre-insert and pre-
> > > update listeners are not intended to be used to change the values of
> > > the entity. Instead they should be used to check-values (for that
> > > reason they return "veto").
> > > I am alittle confused as to the best practice usages/ semantics of
> > > PreUpdate vs OnSaveOrUpdate now. =A0Would someone be able to clarify =
> > > the use of PreInsert and PreUpdate is used by many for Audit trailing
> > > but incorrectly? =A0Or why is the OnSaveOrUpdate listener suggested i=
> > > the closure of NH-2596 and this non peristance is not an issue.