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: Using hierarchies that changes - design question
PostPosted: Fri Mar 18, 2005 4:00 am 
Newbie

Joined: Thu Oct 21, 2004 7:02 am
Posts: 14
Hi,

We have an organizational hierarchy, where one unit can have one parent and multiple children. This works fine. The problem is that we would like to be able to change the parents of the organizational units and keep the history of the hierarchy in some way.

The organizational units store different values in a table, and we are aggregating these values for every period. Eg. If we have an organizational unit A with the children B and C, we would summarize/aggregate all the registered values from all of them (A, B and C) in a period P1. If the child C changes parent in the next period P2, we still need to be able to aggregate the registered values for P1 and get the full aggregation of A, B and C (since C was a child of A in P1).

So I'm wondering if anyone have any tips for how to do this in Hibernate? One way might be to make the associations many-to-many, storing some additional data about the period and if the association is active in the link tables, or something like that. Then fetching the parent or collection of children with some kind of where clause in the mapping, checking for active associations. Another way might be to just store some kind of image of the hierarchy every time it changes.

Anyone tried anything like this before?

Thanks,
Kristian


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 4:39 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I am not sure it will be trivial to aggregate this stuff, but you can think about "change log" table: time | child | new_parent | old_parent.
Time, child and one of new_parent or old_parent is a key in this table, child can not have two parents at the same time in hierarchy.


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.