-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using unsaved value with version field
PostPosted: Tue Nov 14, 2006 12:51 pm 
Newbie

Joined: Thu Nov 25, 2004 11:44 am
Posts: 15
Location: Woodbridge UK
The hibernate XML mapping allows you to specify an unsaved value for the version field of a class using the unsaved-value = "null". Is there an equivalent, or at least something which will allow me to achieve the same effect, with Hibernate annotations?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 3:36 pm 
Newbie

Joined: Thu Dec 14, 2006 3:05 pm
Posts: 1
I am curious on this topic as well. I am currently in the process of converting XML mappings to annotations and have not found an equivalent annotation for the "unsaved-value" attribute of the "version" element. I have run all of my tests and they seem to pass without any annotation specifying an unsaved-value. I have also run a few tests on the behavior of the "version" field when using annotations and it appears to be identical to the behavior when using XML mappings.

Since there is no specified unsaved value via annotations, what can I expect the value of my version field to be when instantiating a new entity and after it is saved and/or persisted? Also, can I expect the annotation mappings to behave exactly like the XML mappings in this case?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 17, 2006 6:38 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
unsaved-value is mostly out of date in hibernate 3.
hibernate use a smart algorithm to guess whether an entity is transient or detached and fall back to the DB if the algorithm fails.
I believe the algorithm is descrived in hiobernate core ref doc (I'm not sure though)

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.