-->
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: Versioning
PostPosted: Sat Mar 13, 2004 2:27 pm 
Newbie

Joined: Thu Oct 02, 2003 2:57 pm
Posts: 9
Location: Sweden
I am pretty new to Hibernate but I find the project extremely well managed and well written. I am currently designing a content management system using Hhibernate as the persistance layer. My problem/question is regarding versioning. I am trying to find a way to store multiple versions of the same object so that I can roll back changes long after the session.

I can see two ways of accomplishing this:
1. Somehow force Hibernate to always do inserts instead of updates, increasing the version on the inserts (possibly by having a composite key).
2. Using an interceptor to somehow store copies of objects when an update occurs.

Any help/suggestions would be very appreciated. I am not really sure what the best solution would be or even if my 2 solutions are even possible.

Thanks

// Ulmus


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 2:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
My Suggestion: Use a database trigger to store a copy in another table.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 3:26 pm 
Expert
Expert

Joined: Thu Jan 08, 2004 6:17 pm
Posts: 278
We are implementing such a concept by just creating an explicit Version entity and an explicit Asset entity; an Asset references a List of Versions. So creating a new Version is done fully explicitly in Java code. This makes it far easier to see what is going on (and allows us to share Versions among Assets, or roll back by re-referencing an earlier Version at the head of the Asset's version list, etc.).

I think doing this at the database level is too low-level to support rich version management semantics. Just do it explicitly in your data model.

Cheers,
Rob


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 3:31 pm 
Expert
Expert

Joined: Thu Jan 08, 2004 6:17 pm
Posts: 278
Oh yes, and read this paper:

http://www.opencm.org/papers/cpcms2001.pdf

Cheers!
Rob


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.