-->
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: Versioning and update/insert behavior
PostPosted: Wed Dec 22, 2004 11:42 pm 
Newbie

Joined: Wed Dec 22, 2004 11:24 pm
Posts: 1
Hello,
I am using versioning for optimistic locking. Let's say I'm using:
Code:
<version name="tstamp" type="long" unsaved-value="undefined"/>


I stress the undefined part, since I read in the docs:
"(undefined specifies that the identifier property value should be used.)".

From this, I understand (and my apologies if my understanding is incorrect) that, by using undefined, I do not want to use the versioning property to determine if a data object is unsaved, but instead wish to defer to the identifier property.

Now, in the code for net.sf.hibernate.engine.Cascades, line 390 (2.1.7c), I see the following:
Code:
/**
* Assume the transient instance is newly instantiated if the version
* is null, otherwise defer to the identifier unsaved-value.
*/
public static final VersionValue VERSION_UNDEFINED = new VersionValue() {
   public final Boolean isUnsaved(Object version) {
      log.trace("version unsaved-value strategy UNDEFINED");
      return version==null ? Boolean.TRUE : null;
   }
};


I wonder if this is indeed correct, as I think the implementation might contradict the documentation. Might not this be the correct implementation?
Code:
/**
* Defer to the identifier unsaved-value.
*/
public static final VersionValue VERSION_UNDEFINED = new VersionValue() {
   public final Boolean isUnsaved(Object version) {
      log.trace("version unsaved-value strategy UNDEFINED");
      return null;
   }
};


Please tell me if my interpretation of what's going on is correct or if I am being silly through the fact that I would really like my interpretation to be correct :)

Thanks a lot!
Alfonso.


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.