-->
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.  [ 5 posts ] 
Author Message
 Post subject: Archived/auditable objects patterns or support
PostPosted: Thu Jun 07, 2007 7:58 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
Are there any good patterns and/or support in Hibernate-JPA for archived/auditable objects?

For example:

class Boss {
Departement dep;
String name;
Date beginDate;
Date endDate;
}
class Employee {
Boss boss;
}

Bosses come and go, so every so often the current bosses endDate becomes now() and a new Boss is created (for the same departement) with a beginDate of now. This means:
- 90% of the queries on bosses need to have a requirement
WHERE beginDate < now() < endDATE
- an update of boss is actually:
-- create new record with old boss details, but endDate = now()
-- update the original old boss record with new boss details, but beginDate = now()
-- this way all Employee's don't need to switch boss every time the old one gets replaced
- a delete becomes endDate = now()

Is this pattern described somewhere (docs, article, ...? What is the correct term for it (archived, auditable, ...)?
Is there any out-of-the-box support for it in hibernate-JPA?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 3:38 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
I saw the annotation @Where in the docs, is anyone using this for archived objects?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 10:13 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
People tend to use filters for such needs.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 8:28 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
Are there any out-of-the-box filters available for working with archived objects? Either in hibernate itself or in other projects?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 8:32 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
In the hibernate-jpa book it's apparently called "Temporal data", but no example is included :/ Any good example or out-of-the-box filter for temporal data is welcomed :)

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.