-->
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.  [ 2 posts ] 
Author Message
 Post subject: SaveOrUpdateCopy bug?
PostPosted: Wed Oct 05, 2005 7:29 pm 
Newbie

Joined: Mon Jun 20, 2005 8:47 pm
Posts: 11
Hiya,

I am seeing different behaviours between using SaveOrUpdate() or SaveOrUpdateCopy() when I use a version number in my mappnig.

Given the following mapping:

Code:

<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="XXX.BusinessEntities" assembly="XXX">

   <class name="ComplianceCriteria" table="ComplianceCriteria"  dynamic-update="true">
       
        <id name="Id" column="CC_ID" type="Int32">
            <generator class="identity" />
        </id>

      <!-- Standard Audit Properties -->
      <version name="RowVersion" column="RowVersion" type="Int32" />
      <property name="CreationUser" column="CreationUser" type="String" />
         <property name="CreationDateTime" column="CreationDateTime" type="DateTime" />
         <property name="LastUpdateUser" column="LastUpdateUser" type="String" />
         <property name="LastUpdateDateTime" column="LastUpdateDateTime" type="DateTime" />
        <!-- End -->

   </class>
</hibernate-mapping>



What I am finding is that the RowVersion property is not updated when I use SaveOrUpdateCopy(). It's as though I lose the reference to the entity through my layers somehow. If this was true though, then I would expect that SaveOrUpdate would exhibit the same behaviour - which it does not - the RowVersion is updated correctly.

Further to this if I run it outside my HTTP handler like this (which is basically what my handler is doing):

Code:
Dim cc As New ComplianceCriteria
Dim session As ISession = _sessionFactory.OpenSession()
cc = CType(session.Load(cc.GetType(), 2), ComplianceCriteria)
session.FlushMode = FlushMode.Commit
session.BeginTransaction()
session.SaveOrUpdateCopy(cc)
session.Transaction.Commit()
session.Close()


Then the RowVersion is updated OK.

So I am kinda confused. Can anyone shed some light on this?

Cheers,

Mike :D


Top
 Profile  
 
 Post subject: More Info
PostPosted: Thu Oct 06, 2005 6:07 pm 
Newbie

Joined: Mon Jun 20, 2005 8:47 pm
Posts: 11
I am using RC1

Thanks


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

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.