-->
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: Object evolution follow up. How to ?
PostPosted: Wed Feb 13, 2008 11:32 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
I would like to be able to store the different states of my object instance through time.

So, I added a timestamped version property to my object.

The thing is that version obviously just update the property value to work with the detached instances.

so here is my mapping file :
Code:
<class name="Demande" table="DEMANDE" optimistic-lock="version">
   
   <id name="id" type="long">
      
      <generator class="sequence">
         <param name="sequence">demande_seq</param>
      </generator>
   </id>
      
   <version type="timestamp" column="DATE_ETAT" name="dateEtat" />

   <property name="contenu" type="text"/>
   <property name="dateArrivee" type="timestamp"
      column="DATE_ARRIVEE" />

   <many-to-one name="etat" column="ETAT_ID"/>
   <!-- more irrelevant things -->
</class>


I would like to things this way so I could get an easy trace of the evolution of the object. In fact, the etat property contains the state of the instance, and that is quite the only thing I want to follow through time.

If I want to work on THE instance, I would just retrieve the later timestamped instance. If I want to see the complete trace for this isntance, I would get all the versions of the instance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 11:34 am 
Beginner
Beginner

Joined: Mon Sep 26, 2005 8:22 am
Posts: 24
thinking about it, I guess the version property should here be part of the key.

but that would mean specific SQL code to Create/Select/Update instances...


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.