After stepping through the NHibernate code, I figured out the problem
and found a temporary solution. As I stated earlier, we are using
Spring.NET along with NHibernate inside of our persistence layer. For
some reason, our entity objects are not getting stored in the cashed
database snapshot (I need to look into this in more detail), and it is
this cashed database snapshot that NHibernate checks to determine
whether or not properties are dirty and whether or not the property
being dirty should cause a version increment.
For any mapping file that has a property with the optimistic-lock
attribute set to false, I added the select-before-update="true"
attribute to the class. This forces NHibernate to get the entity
state from the database when checking for dirty properties. Now the
version property is being correctly updated (or not updated) as I
would expect (based on the optimistic-lock="false" attribute).
I know that we may hit some performance issues with this temporary
solution, which is why it is only temporary. Once I figure out why
our objects are not getting cached in the database snapshot (need to
investigate how Spring.NET is managing the Session), I will update
this post.
Fabio, thanks for your helpful links!
On Jan 6, 11:22 am, "Fabio Maulo" <
fabioma...@gmail.com> wrote:
>
http://nhforge.org/doc/nh/en/index.html#manipulatingdata-flushinghttp://nhforge.org/doc/nh/en/index.html#transactions-optimistic
>
> 2009/1/6 Fabio Maulo <
fabioma...@gmail.com>
>
>
>
>
>
> > I'm sure that there is something saying the difference between a
> > session.Save, session.Update, session.Delete and session.Flush...If I well
> > 2009/1/6 j gwood <
jean.greenw...@gmail.com>