I'm using latest NHibernate.
I'm having this exception thrown when trying to SaveOrUpdate (and then do a Session.Flush) for a detached entity:
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for XXX.Brand instance with identifier: 105
I compiled NHibernate in debug to step through it and the cause of this problem and the error comes from when an SqlCommand is executed using ExecuteNonQuery(), this method then returns -1, once this happens the method Check in AbstractEntityPersister throws a StaleObjectStateException.
I don't have any triggers happening on any of the tables and I am not running the current queries within a transaction.
Any ideas why I am getting this -1 for the affected records count ?
PS: the relevant settings for the SessionFactory are:
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="prepare_sql">false</property>
<property name="max_fetch_depth">1</property>
<property name="show_sql">true</property>
<property name="adonet.batch_size">0</property>
Cheers
Daniel
|