-->
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.  [ 4 posts ] 
Author Message
 Post subject: Loading records from versioned tables
PostPosted: Tue Mar 30, 2004 6:55 am 
Newbie

Joined: Tue Mar 30, 2004 6:52 am
Posts: 2
Hibernate 2.1.2

Is there a way to automatically read the latest version of a record. I have the following mapping excerpt:

...
<id name="number" column="PROPNUM" type="java.lang.String"/>
<generator class="assigned"/>
</id>
<version name="version" type="long" column="VERSIONNUM" />
...

is it possible using Session.get(), Session.load() or similars.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 9:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
There cannot be different versions of the same object in the table. This column is only here to keep track of the last version, not to keep track of all the versions.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 9:51 am 
Newbie

Joined: Tue Mar 30, 2004 6:52 am
Posts: 2
emmanuel wrote:
There cannot be different versions of the same object in the table. This column is only here to keep track of the last version, not to keep track of all the versions.


Thanks. So if I have a table which stores all the versions of a record I have to create a composite ID (UID,version). Is it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 10:18 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Correct, and thus don't use <version> tag, I don't think it is intended to be used in your case.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.