These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem with <select-before-update>
PostPosted: Mon Jan 22, 2007 12:06 pm 
Beginner
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.