-->
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: How can I store historical data with a complex object graph?
PostPosted: Sun Jun 28, 2009 3:08 pm 
Newbie

Joined: Sun Apr 12, 2009 4:43 am
Posts: 11
Hi,
I have a object with a fairly complex domain model i.e. the usual collections, subclasses and associations going at least two or three levels deep. I am using foreign keys by and large to allow me to form the appropriate associations.
We have a requirement to pretty much be able to recreate the DB at any point in time, so whenever an update is performed on a subset of data, we need to create a snapshot of the object as it was.
I can do this if I deep copy the object, nulling the primary keys and saving the new version (I assume!). New primary key and foreign key relationships will be set up so that I can recreate my new version of the object as well as the old one. I have all the data in the one table, which has the advantages of:
a) not having to define similar history schema
b) not having to map two sets of objects
c) not having to work with two sets of POJOs
However, I'd like to avoid duplication of data somehow, as this will increase exponentially the more levels the object graph has.

When the user wants to update the current version of the object, I think the sequence of events will be:
a) retrieve current version (by date query or version, whichever)
b) allow user to make updates on UI
c) instead of updating object, create a new copy and save it
Without doing a deep compare with the previous version, I dont see that I can avoid data duplication here .. and I'd like to avoid a field-by-field comparison (Hibernate would be better at knowing whether an update occurred?)
If anyone has anything helpful to say, please do .. I'm sure it's a common problem. We were considering Envers also but weren't sure if it was mature enough to handle anything we threw at it, so if people have had a good experience with it, I'd be interested ..
many thanks, Baljeet.


Top
 Profile  
 
 Post subject: Re: How can I store historical data with a complex object graph?
PostPosted: Tue Sep 01, 2009 8:07 am 
Newbie

Joined: Wed Aug 26, 2009 9:01 am
Posts: 4
Did you try envers? It is a new component of hibernate, and it is going to be availabe in hibernate-core-3.5.

There is also a compatible version for hibernate 3.3.

HernĂ¡n.


Top
 Profile  
 
 Post subject: Re: How can I store historical data with a complex object graph?
PostPosted: Tue Sep 01, 2009 8:29 am 
Newbie

Joined: Sun Aug 30, 2009 8:26 am
Posts: 7
When I see sistuaions like this, I always think: is a relational database the best place to store these types of objects.

If you're only using the RDB as a persistence store, and your app is the only one that will ever query the data, then you may want to look at a solution that is more suited to storing theses more complex objects.

I know it doesn't answer your question, but I thought I'd provide a different perspective.

Vackar


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.