Beginner |
 |
Joined: Fri Jan 19, 2007 10:45 am Posts: 23
|
Hello,
I'm using NHibernate 1.2.0
I have a very basic object Account with property "Id" and "NoCli".
I'm using the very basic following mapping
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="WindowsApplication1" assembly="WindowsApplication1">
<class name="Account" table="Account" select-before-update="true" dynamic-update="true">
<id name="Id">
<column name="AccountId" sql-type="char(32)" not-null="true"/>
<generator class="increment" />
</id>
<property name="NoCli" />
</class>
</hibernate-mapping>
I retreive an Account using a Session which I close immediatly after.
Then I update the Account and send it to the following method many times :
ISession session = m_sessionFactory.OpenSession();
session.SaveOrUpdate(account);
session.Flush();
session.Close();
NHibernate performs each time a SELECT+UPDATE statements(incrementing the Version number) instead of doing that only the first time I call the method ( the following times, only the SELECT statement should be performed)
It looks like the "select-before-update" optin is not working properly.
Any idea ?
Thanks a lot for your help...
|
|