-->
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.  [ 8 posts ] 
Author Message
 Post subject: Smartest way to implement history function ?!!
PostPosted: Mon Sep 20, 2004 5:45 am 
Beginner
Beginner

Joined: Tue Sep 07, 2004 3:58 am
Posts: 23
Hibernate version:
2.1.6

Hibernate designing question:
Whar is the most fitting way in hibernate to implement data access that never really deletes an object, but creates a new instance and marks the old one as "out-of-time".

My current approach (without hibernate) was to keep two timestamps with each entry - a "birth-date" and a "death-date" .... so "updating" was to set a death-date of the old version and insert the new version with a new birth-date while "deleting" was setting a death date without inserting a new entry....

Another approach would be to keep just the birth date and a "deleted" flag...

Now the questions:

Which model is better for hibernate to use ?

Some tips on where and how to do it would we be very fine of you as well

:o)

J

_________________
People keep asking me if i know Tyler Durden....


Top
 Profile  
 
 Post subject: After some more discussions...
PostPosted: Mon Sep 20, 2004 6:13 am 
Beginner
Beginner

Joined: Tue Sep 07, 2004 3:58 am
Posts: 23
....with other people working on it it seems that the 2-timestamp model seems to be better, in the other model you dont know WHEN it was deleted, e.g. when you got an entry with a birth-date 1999 and the deleted flag set and you want to know the data of 2000 you dont know if the entry was deleted 1999 or 2001....

so it HAS to be the 2-timestamp model...

_________________
People keep asking me if i know Tyler Durden....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 9:26 am 
Beginner
Beginner

Joined: Tue Sep 07, 2004 3:58 am
Posts: 23
My first try would be an interceptor where the objects in the saved array would be modified (death-date set...) and the "new" versions would be added to the array....

It could work, but i guess theres a better way....

_________________
People keep asking me if i know Tyler Durden....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 9:32 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you can customize this pattern
http://blog.hibernate.org/cgi-bin/blosx ... rytriggers

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 9:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
http://blog.hibernate.org/cgi-bin/blosxom.cgi/Christian%20Bauer/relational/historytriggers.html

Damn, anthony faster again :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 11:06 am 
Beginner
Beginner

Joined: Tue Sep 07, 2004 3:58 am
Posts: 23
Thx for the tip guys.... quite fast you are :o)

i looked through it and im unsure if its good for my environment, cause we are using mysql and mysql only supports triggers in version 5.0 which is indicated as alpha release....

Anyone any experiences with MySQL 5.0 ? Stability is a major point in my case....

Or any other approaches ?

_________________
People keep asking me if i know Tyler Durden....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 11:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Get a real database :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 11:20 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
;))

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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