-->
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: Composing an object from multiple tables + Versioning
PostPosted: Fri Jan 08, 2010 4:49 am 
Newbie

Joined: Fri Jan 08, 2010 4:33 am
Posts: 1
Hello everyone,

We are trying to implement entity versioning / history to a system that wasn't originally designed for it.

We want that each update to a versioned entity results in a new row instead of an update. We also need to retrieve the versioned entities (which are often associated together) at certain points of time. Basically there are Reports which refer to a these entities and the reports need to use the the versions of entities that were valid at the time the report was created.

Currently we are looking at having two database tables for each versioned entity:

ENTITY-table would have the unchanging things, mostly just the entity's id and id's of the associated other entities.

ENTITY_VERSION table would have all the values that can change together with VALID_FROM , VALID_TO values.

Now, is it possible to map the ENTITY POJO so that a) The fields would be composed from both tables b) somehow parameterize it with a date so that the correct row from the ENTITY_VERSION table would be used to populate the fields?

Or is there some more obvious way to achieve this?

(Edit: We use MySQL 5 and the latest GA release of Hibernate)


Top
 Profile  
 
 Post subject: Re: Composing an object from multiple tables + Versioning
PostPosted: Fri Jan 08, 2010 11:07 am 
Regular
Regular

Joined: Thu Dec 10, 2009 10:53 am
Posts: 50
Have you given envers a try?

We are basically trying to achieve the same goal as you, but envers is not able to traverse associations when querying historical data. This is why we have to build our own approach. Depending on your requirements envers might be sufficient for you.


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.