Fabio, thank you so much for your reply.

Sorry I do not think I am explaining myself very well, may I please
ask you to download this sln (http://dl.dropbox.com/u/20651208/
WTF.zip) and I can demonstrate with just 3 tests in the
BecauseOfEventHandling class;

1. Test a_onPre_event_listeners_fired_and_entities_modified() shows
the OnPreUpdate event is processing as expected.
2. Test
b_onPreUpdate_event_listener_fired_but_no_persistance_on_auditable_entity()
shows where I have my issue.
3. Test
c_onPreUpdate_event_listener_fired_with_persistance_on_auditable_entity()
shows a work around which highlights an issue??

I hope this makes everything clearer and that I am not trying to do
any NH internal stuff, only using the OnPreUpdate event listeners.
Thank you so much for your patience.


On Apr 8, 6:59 am, Fabio Maulo <[email protected]> wrote:
> Scott,
> to change properties try to follow what I said and you will see that it is
> even more easy (you have to deal only with your object and not with NH
> internals).
>
> On Wed, Apr 6, 2011 at 4:42 AM, Scott Findlater 
> <[email protected]>wrote:
>
>
>
>
>
>
>
>
>
> > Hi Suman,
>
> > I would be interested to know if you are updating any other properties
> > in your subclass, that after removing dynamic-update=true, 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 am, Suman <[email protected]> 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 = "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 = "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 pm, Scott Findlater <[email protected]> wrote:
>
> > > > Please may I ask for clarification on the semantics/ usage of
> > > > PreUpdate vs OnSaveOrUpdate listeners based on NH-2596 (http://
> > > > 216.121.112.228/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.  During my learning I raised NH-2617 (http://
> > > > 216.121.112.228/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.  However, NH-2596 is
> > > > also closed as “not an issue” 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.  Would someone be able to clarify why
> > > > the use of PreInsert and PreUpdate is used by many for Audit trailing
> > > > but incorrectly?  Or why is the OnSaveOrUpdate listener suggested in
> > > > the closure of NH-2596 and this non peristance is not an issue.
>
> > > > Many thanks, Scott.
>
> > --
> > 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.
>
> --
> 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