This is, IMHO, a problem with how NHibernate implements events. I once discussed this with Fabio (a long, long time ago), back then, I was questioning why is the SaveOrUpdate event fired even for unchanged entities. This is another version of the same problem, I guess: FlushEntity is also fired for unchanged entities. The problem with this is that we first need to check, before we touch the target entity, if it is changed. In my view of things, these events should only be fired upon changed entities.
RP On Tuesday, November 19, 2013 7:29:32 AM UTC, Gunnar Liljas wrote: > > You're testing the wrong thing. The entity will be flushed. That doesn't > mean that it will be updated. It means that it will be dirty checked and > *possibly* updated. > > /G > > > 2013/11/18 Sid Shetye <[email protected] <javascript:>> > >> Hi folks, >> >> I've created a self-sufficient test project in GIT at >> https://github.com/sidshetye/NHMarkEntityClean which demonstrates this >> issue. The local database etc is all setup, you can simply run it and see >> the phantom FlushEvent being called on the entity when it shouldn't have >> (because we just reset it properly). >> >> The user-level listener code at >> https://github.com/sidshetye/NHMarkEntityClean/blob/master/NHListeners.csseems >> simple to me - not sure what the problem is ... because >> OnFlushEntity() still gets called on this now "unchanged" entity. Either >> we're not resetting the entity properly or NHibernate's clean/dirty check >> has a bug in it. >> >> Any ideas on this puzzle? >> >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/nhusers. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
