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.
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 <scottfindla...@gmail.com> 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.
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 <sumanre...@gmail.com> wrote:
> 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 <scottfindla...@gmail.com> 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.
> 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 <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 = "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 <scottfindla...@gmail.com> 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.
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 <scottfindla...@gmail.com>wrote:
> 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 <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 = "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 <scottfindla...@gmail.com> 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 nhusers@googlegroups.com. > To unsubscribe from this group, send email to > nhusers+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en.
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 <fabioma...@gmail.com> 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 <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=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 <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 = "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 <scottfindla...@gmail.com> 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 nhusers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
Scott, PreUpdate, PreInsert, PreDelete are to check entity state (as most even to log) but NOT TO CHANGE entity state. Again, try to follow what I said.
To Log the old state or the difference you can use even the PostXYZ.
On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater <scottfindla...@gmail.com>wrote:
> 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 <fabioma...@gmail.com> 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 < > 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=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 <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 = "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 <scottfindla...@gmail.com> 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 nhusers@googlegroups.com. > > > To unsubscribe from this group, send email to > > > nhusers+unsubscribe@googlegroups.com. > > > 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 nhusers@googlegroups.com. > To unsubscribe from this group, send email to > nhusers+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en.
Hi Fabio, OK, obviously you are right :) I will stop trying to change
entity state in these events. It is just NOT TO CHANGE state in these
events is not really documented anywhere and from blog posts give
examples of using the OnPreInsert and OnPreUpdate event listeners as
the perfect place for mechanisms such as Audit trails which do change
entity state. To conclude, I will obviously follow your guidance. I
really appreciate your patience. Kind regards, Scott.
On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> Scott,
> PreUpdate, PreInsert, PreDelete are to check entity state (as most even to
> log) but NOT TO CHANGE entity state.
> Again, try to follow what I said.
> To Log the old state or the difference you can use even the PostXYZ.
> On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater <scottfindla...@gmail.com>wrote:
> > 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 <fabioma...@gmail.com> 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 <
> > 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=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 <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 = "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 <scottfindla...@gmail.com> 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 nhusers@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > nhusers+unsubscribe@googlegroups.com.
> > > > 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 nhusers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
"is not really documented anywhere" That is only because we are still waiting your patch for the NHibernate public documentation. If you don't want to send a patch you can use the nhforge wiki, the knol ( http://knol.google.com), share your experience in your blog, share your experience in the www.nhforge.org blog
We wrote tons of code, somebody else can write a little bit of text.
On Fri, Apr 8, 2011 at 12:58 PM, Scott Findlater <scottfindla...@gmail.com>wrote:
> Hi Fabio, OK, obviously you are right :) I will stop trying to change > entity state in these events. It is just NOT TO CHANGE state in these > events is not really documented anywhere and from blog posts give > examples of using the OnPreInsert and OnPreUpdate event listeners as > the perfect place for mechanisms such as Audit trails which do change > entity state. To conclude, I will obviously follow your guidance. I > really appreciate your patience. Kind regards, Scott.
> On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > Scott, > > PreUpdate, PreInsert, PreDelete are to check entity state (as most even > to > > log) but NOT TO CHANGE entity state. > > Again, try to follow what I said.
> > To Log the old state or the difference you can use even the PostXYZ.
> > On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater < > scottfindla...@gmail.com>wrote:
> > > 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 <fabioma...@gmail.com> 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 < > > > 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=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.
> > > > > > 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 <scottfindla...@gmail.com> > 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 nhusers@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > 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 nhusers@googlegroups.com. > > > To unsubscribe from this group, send email to > > > nhusers+unsubscribe@googlegroups.com. > > > 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 nhusers@googlegroups.com. > To unsubscribe from this group, send email to > nhusers+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en.
> "is not really documented anywhere"
> That is only because we are still waiting your patch for the NHibernate
> public documentation.
> If you don't want to send a patch you can use the nhforge wiki, the knol (http://knol.google.com), share your experience in your blog, share your
> experience in thewww.nhforge.orgblog
> We wrote tons of code, somebody else can write a little bit of text.
> On Fri, Apr 8, 2011 at 12:58 PM, Scott Findlater
> <scottfindla...@gmail.com>wrote:
> > Hi Fabio, OK, obviously you are right :) I will stop trying to change
> > entity state in these events. It is just NOT TO CHANGE state in these
> > events is not really documented anywhere and from blog posts give
> > examples of using the OnPreInsert and OnPreUpdate event listeners as
> > the perfect place for mechanisms such as Audit trails which do change
> > entity state. To conclude, I will obviously follow your guidance. I
> > really appreciate your patience. Kind regards, Scott.
> > On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> > > Scott,
> > > PreUpdate, PreInsert, PreDelete are to check entity state (as most even
> > to
> > > log) but NOT TO CHANGE entity state.
> > > Again, try to follow what I said.
> > > To Log the old state or the difference you can use even the PostXYZ.
> > > On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater <
> > scottfindla...@gmail.com>wrote:
> > > > 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 <fabioma...@gmail.com> 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 <
> > > > 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=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.
> > > > > > > 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 <scottfindla...@gmail.com>
> > 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 nhusers@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > nhusers+unsubscribe@googlegroups.com.
> > > > > > 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 nhusers@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > nhusers+unsubscribe@googlegroups.com.
> > > > 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 nhusers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
I asked you to write a wiki, right ? well... imagine that you do it and after some moths somebody else will ask me "why that wiki say those things ?" what should I answer ?
On Fri, Apr 8, 2011 at 5:34 PM, Scott Findlater <scottfindla...@gmail.com>wrote:
> Touche Fabio :) > I will make a deal with you ... I will write an in depth documentation > patch about the NH event model if you can please explain why there is > wiki article explaining how to create an audit log which clearly uses > the OnPre events to CHANGE ENTITY state -
> On Apr 8, 7:33 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > "is not really documented anywhere" > > That is only because we are still waiting your patch for the NHibernate > > public documentation. > > If you don't want to send a patch you can use the nhforge wiki, the knol > (http://knol.google.com), share your experience in your blog, share your > > experience in thewww.nhforge.orgblog
> > We wrote tons of code, somebody else can write a little bit of text.
> > On Fri, Apr 8, 2011 at 12:58 PM, Scott Findlater > > <scottfindla...@gmail.com>wrote:
> > > Hi Fabio, OK, obviously you are right :) I will stop trying to change > > > entity state in these events. It is just NOT TO CHANGE state in these > > > events is not really documented anywhere and from blog posts give > > > examples of using the OnPreInsert and OnPreUpdate event listeners as > > > the perfect place for mechanisms such as Audit trails which do change > > > entity state. To conclude, I will obviously follow your guidance. I > > > really appreciate your patience. Kind regards, Scott.
> > > On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > > > Scott, > > > > PreUpdate, PreInsert, PreDelete are to check entity state (as most > even > > > to > > > > log) but NOT TO CHANGE entity state. > > > > Again, try to follow what I said.
> > > > To Log the old state or the difference you can use even the PostXYZ.
> > > > On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater < > > > scottfindla...@gmail.com>wrote:
> > > > > 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 <fabioma...@gmail.com> 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 < > > > > > 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=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.
> > > > > > > > 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 <scottfindla...@gmail.com
> > > 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).
> 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 nhusers@googlegroups.com. > > > > > > > To unsubscribe from this group, send email to > > > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > > > 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 nhusers@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > 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 nhusers@googlegroups.com. > > > To unsubscribe from this group, send email to > > > nhusers+unsubscribe@googlegroups.com. > > > 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 nhusers@googlegroups.com. > To unsubscribe from this group, send email to > nhusers+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en.
Fabio, I would like you to answer it is wrong or why it is ok, because
on one hand you tell me do not change state in these events and on the
other hand there are NH wiki posts changing state in these events. I
am very confused as to what is correct?
On Apr 8, 11:10 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> I asked you to write a wiki, right ?
> well... imagine that you do it and after some moths somebody else will ask
> me "why that wiki say those things ?"
> what should I answer ?
> On Fri, Apr 8, 2011 at 5:34 PM, Scott Findlater <scottfindla...@gmail.com>wrote:
> > Touche Fabio :)
> > I will make a deal with you ... I will write an in depth documentation
> > patch about the NH event model if you can please explain why there is
> > wiki article explaining how to create an audit log which clearly uses
> > the OnPre events to CHANGE ENTITY state -
> > On Apr 8, 7:33 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> > > "is not really documented anywhere"
> > > That is only because we are still waiting your patch for the NHibernate
> > > public documentation.
> > > If you don't want to send a patch you can use the nhforge wiki, the knol
> > (http://knol.google.com), share your experience in your blog, share your
> > > experience in thewww.nhforge.orgblog
> > > We wrote tons of code, somebody else can write a little bit of text.
> > > On Fri, Apr 8, 2011 at 12:58 PM, Scott Findlater
> > > <scottfindla...@gmail.com>wrote:
> > > > Hi Fabio, OK, obviously you are right :) I will stop trying to change
> > > > entity state in these events. It is just NOT TO CHANGE state in these
> > > > events is not really documented anywhere and from blog posts give
> > > > examples of using the OnPreInsert and OnPreUpdate event listeners as
> > > > the perfect place for mechanisms such as Audit trails which do change
> > > > entity state. To conclude, I will obviously follow your guidance. I
> > > > really appreciate your patience. Kind regards, Scott.
> > > > On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> > > > > Scott,
> > > > > PreUpdate, PreInsert, PreDelete are to check entity state (as most
> > even
> > > > to
> > > > > log) but NOT TO CHANGE entity state.
> > > > > Again, try to follow what I said.
> > > > > To Log the old state or the difference you can use even the PostXYZ.
> > > > > On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater <
> > > > scottfindla...@gmail.com>wrote:
> > > > > > 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 <fabioma...@gmail.com> 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 <
> > > > > > 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=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.
> > > > > > > > > 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 <scottfindla...@gmail.com
> > > > 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).
> > 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 nhusers@googlegroups.com.
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > nhusers+unsubscribe@googlegroups.com.
> > > > > > > > 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 nhusers@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > nhusers+unsubscribe@googlegroups.com.
> > > > > > 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 nhusers@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > nhusers+unsubscribe@googlegroups.com.
> > > > 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 nhusers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
> Fabio, I would like you to answer it is wrong or why it is ok, because > on one hand you tell me do not change state in these events and on the > other hand there are NH wiki posts changing state in these events. I > am very confused as to what is correct?
> On Apr 8, 11:10 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > I asked you to write a wiki, right ? > > well... imagine that you do it and after some moths somebody else will > ask > > me "why that wiki say those things ?" > > what should I answer ?
> > On Fri, Apr 8, 2011 at 5:34 PM, Scott Findlater < > scottfindla...@gmail.com>wrote:
> > > Touche Fabio :) > > > I will make a deal with you ... I will write an in depth documentation > > > patch about the NH event model if you can please explain why there is > > > wiki article explaining how to create an audit log which clearly uses > > > the OnPre events to CHANGE ENTITY state -
> > > On Apr 8, 7:33 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > > > "is not really documented anywhere" > > > > That is only because we are still waiting your patch for the > NHibernate > > > > public documentation. > > > > If you don't want to send a patch you can use the nhforge wiki, the > knol > > > (http://knol.google.com), share your experience in your blog, share > your > > > > experience in thewww.nhforge.orgblog
> > > > We wrote tons of code, somebody else can write a little bit of text.
> > > > On Fri, Apr 8, 2011 at 12:58 PM, Scott Findlater > > > > <scottfindla...@gmail.com>wrote:
> > > > > Hi Fabio, OK, obviously you are right :) I will stop trying to > change > > > > > entity state in these events. It is just NOT TO CHANGE state in > these > > > > > events is not really documented anywhere and from blog posts give > > > > > examples of using the OnPreInsert and OnPreUpdate event listeners > as > > > > > the perfect place for mechanisms such as Audit trails which do > change > > > > > entity state. To conclude, I will obviously follow your guidance. > I > > > > > really appreciate your patience. Kind regards, Scott.
> > > > > On Apr 8, 3:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote: > > > > > > Scott, > > > > > > PreUpdate, PreInsert, PreDelete are to check entity state (as > most > > > even > > > > > to > > > > > > log) but NOT TO CHANGE entity state. > > > > > > Again, try to follow what I said.
> > > > > > To Log the old state or the difference you can use even the > PostXYZ.
> > > > > > On Fri, Apr 8, 2011 at 9:54 AM, Scott Findlater < > > > > > scottfindla...@gmail.com>wrote:
> > > > > > > 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 <fabioma...@gmail.com> 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 < > > > > > > > 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=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.
> > > > > > > > > > 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 < > scottfindla...@gmail.com
> > > > > 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).
> > > 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 > nhusers@googlegroups.com. > > > > > > > > > To unsubscribe from this group, send email to > > > > > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > > > > > 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 nhusers@googlegroups.com. > > > > > > > To unsubscribe from this group, send email to > > > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > > > 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 nhusers@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > nhusers+unsubscribe@googlegroups.com. > > > > > 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 nhusers@googlegroups.com. > > > To unsubscribe from this group, send email to > > > nhusers+unsubscribe@googlegroups.com. > > > 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
To jump in here. I wrote the article you referred to in your reply to
Fabio, and tbh, I wouldn't consider it official NHibernate
documentation. It was written a long time ago as an example of the
things you could do with the events,when documentation on the
interfaces as opposed to the old interceptors was very thin on the
ground, and my article was written to formalise Ayende's article so
that NH Forge had something that could be easily found.
If it is not best practice then I can only apologise for the confusion
it has caused, but this is the problem with NH; there is little
"official" documentation , except maybe the NH 3.0 cookbook. Most
people, including myself, take blogs from people like Ayende as the
defacto documentation as we know they are core contributors to NH. If
people like Ayende are writing blogs (which are basically around
forever) that are either inaccurate or have become so with subsequent
releases, then there isn't a lot us "normal" people can do who do not
understand the inner workings of NH as well as people like Fabio.
When I get time I will look into amending the offending wiki entry.
And just to clarify, this isn't a complaint at anyone. NH is a free
product that is as good as anything else on the market, if not better,
and it's worked on unpaid by the developers, so those of us who use it
should be grateful for this and that NH is still an active product.
On the flip side, the developers should also appreciate that
information on NH is scattered all over the place, is sometimes
contradictory, and can be very confusing to those trying to understand
how it all works.
Graham. In NH you can archive the same target in various ways. Your wiki (What I Know Is) is good enough to solve a problem in a way. but.... but a WIKI is a WIKI for example this WIKI shows various tech to do the same http://nhforge.org/wikis/howtonh/localization-techniques.aspx <http://nhforge.org/wikis/howtonh/localization-techniques.aspx>When a user find something wrong in a WIKI he can modify/correct it even if it was wrote by somebody else. This is the spirit of the WIKI... it does not to be perfect.. it just need to be perfectible.
Thanks Graham for your support and your spirit sharing your knowledge.
On Sat, Apr 9, 2011 at 6:03 PM, Graham Bunce <grahambu...@hotmail.com>wrote:
> To jump in here. I wrote the article you referred to in your reply to > Fabio, and tbh, I wouldn't consider it official NHibernate > documentation. It was written a long time ago as an example of the > things you could do with the events,when documentation on the > interfaces as opposed to the old interceptors was very thin on the > ground, and my article was written to formalise Ayende's article so > that NH Forge had something that could be easily found.
> If it is not best practice then I can only apologise for the confusion > it has caused, but this is the problem with NH; there is little > "official" documentation , except maybe the NH 3.0 cookbook. Most > people, including myself, take blogs from people like Ayende as the > defacto documentation as we know they are core contributors to NH. If > people like Ayende are writing blogs (which are basically around > forever) that are either inaccurate or have become so with subsequent > releases, then there isn't a lot us "normal" people can do who do not > understand the inner workings of NH as well as people like Fabio.
> When I get time I will look into amending the offending wiki entry.
> -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to nhusers@googlegroups.com. > To unsubscribe from this group, send email to > nhusers+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en.
> Graham.
> In NH you can archive the same target in various ways.
> Your wiki (What I Know Is) is good enough to solve a problem in a way.
> but....
> but a WIKI is a WIKI
> for example this WIKI shows various tech to do the samehttp://nhforge.org/wikis/howtonh/localization-techniques.aspx > <http://nhforge.org/wikis/howtonh/localization-techniques.aspx>When a user
> find something wrong in a WIKI he can modify/correct it even if it was wrote
> by somebody else.
> This is the spirit of the WIKI... it does not to be perfect.. it just need
> to be perfectible.
> Thanks Graham for your support and your spirit sharing your knowledge.
> On Sat, Apr 9, 2011 at 6:03 PM, Graham Bunce <grahambu...@hotmail.com>wrote:
> > Scott,
> > To jump in here. I wrote the article you referred to in your reply to
> > Fabio, and tbh, I wouldn't consider it official NHibernate
> > documentation. It was written a long time ago as an example of the
> > things you could do with the events,when documentation on the
> > interfaces as opposed to the old interceptors was very thin on the
> > ground, and my article was written to formalise Ayende's article so
> > that NH Forge had something that could be easily found.
> > If it is not best practice then I can only apologise for the confusion
> > it has caused, but this is the problem with NH; there is little
> > "official" documentation , except maybe the NH 3.0 cookbook. Most
> > people, including myself, take blogs from people like Ayende as the
> > defacto documentation as we know they are core contributors to NH. If
> > people like Ayende are writing blogs (which are basically around
> > forever) that are either inaccurate or have become so with subsequent
> > releases, then there isn't a lot us "normal" people can do who do not
> > understand the inner workings of NH as well as people like Fabio.
> > When I get time I will look into amending the offending wiki entry.
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to nhusers@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
> On Apr 10, 1:11 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> > Graham.
> > In NH you can archive the same target in various ways.
> > Your wiki (What I Know Is) is good enough to solve a problem in a way.
> > but....
> > but a WIKI is a WIKI
> > for example this WIKI shows various tech to do the samehttp://nhforge.org/wikis/howtonh/localization-techniques.aspx > > <http://nhforge.org/wikis/howtonh/localization-techniques.aspx>When a user
> > find something wrong in a WIKI he can modify/correct it even if it was wrote
> > by somebody else.
> > This is the spirit of the WIKI... it does not to be perfect.. it just need
> > to be perfectible.
> > Thanks Graham for your support and your spirit sharing your knowledge.
> > On Sat, Apr 9, 2011 at 6:03 PM, Graham Bunce <grahambu...@hotmail.com>wrote:
> > > Scott,
> > > To jump in here. I wrote the article you referred to in your reply to
> > > Fabio, and tbh, I wouldn't consider it official NHibernate
> > > documentation. It was written a long time ago as an example of the
> > > things you could do with the events,when documentation on the
> > > interfaces as opposed to the old interceptors was very thin on the
> > > ground, and my article was written to formalise Ayende's article so
> > > that NH Forge had something that could be easily found.
> > > If it is not best practice then I can only apologise for the confusion
> > > it has caused, but this is the problem with NH; there is little
> > > "official" documentation , except maybe the NH 3.0 cookbook. Most
> > > people, including myself, take blogs from people like Ayende as the
> > > defacto documentation as we know they are core contributors to NH. If
> > > people like Ayende are writing blogs (which are basically around
> > > forever) that are either inaccurate or have become so with subsequent
> > > releases, then there isn't a lot us "normal" people can do who do not
> > > understand the inner workings of NH as well as people like Fabio.
> > > When I get time I will look into amending the offending wiki entry.
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "nhusers" group.
> > > To post to this group, send email to nhusers@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > nhusers+unsubscribe@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.