NHibernate 1.2
Hi,
I have optimistic locking set on a class also with a version timestamp.
Code:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="FusionPlugin.Model.ConversationNode, FusionPlugin" lazy="false" table="fusion_quests_conv" optimistic-lock="version">
<id name="Guid" type="string" unsaved-value="null">
<column name="guid" sql-type="varchar(64)" not-null="true" />
<generator class="Fusion.FusionIDGenerator, SubFusion" />
</id>
<!--<timestamp name="version" generated="never" access="field" column="version"/>-->
<version name="version" access="field" column="version" type="timestamp" generated="never"/>
<many-to-one class="FusionPlugin.Model.Quest, FusionPlugin" name="Quest" column="quest" not-null="true"/>
</class>
</hibernate-mapping>
The version generates fine now, however something strange occurs. I serialize the object to disk between application starts and when I de-serialize it, I session.Update(po,po.guid) the object with some new state. Works fine. Now, if I manually alter the version timestamp in the database for that object, I expect my next object update to cause a lock collision.
Well, sorta. It correctly does not overwrite the database state with the new object state (because the versions do not match), but it also does not throw an exception to notify my application of a stale state for this object. Rather, session.Update(po,po.guid) just returns gracefully.
I can reproduce this at will.
Any clues?
thanks,
Sessh