-->
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: How to create a high performance object graph w/denormalized
PostPosted: Thu Sep 30, 2004 11:48 am 
Newbie

Joined: Sat Sep 04, 2004 2:41 am
Posts: 2
I am trying to model an object graph of Nodes in a Hierarchy where Nodes have multiple parent Nodes and multiple child Nodes and I need some help! :) Fundamentally, we need to be able to get all of the parents for a given node recursively up the graph very efficiently. For example:

Code:
Given a simple hierarchy 1 --> 2 -->3, the parents for node 3 are 2 and 1.

We need to be able to determine all transitive parents in one sql query.

So far I have been able to create an inverted tree pretty easily. I manually maintained a denormalized version of the parent/child relationships in a separate table. Using the above example, this denormalized table would contain the following rows:

Code:
PARENT_ID, CHILD_ID
2,3
1,3

Using this approach, I can get all of the parents for a given node by joining this table with the Node table. Here are the two questions that I really need some help answering:
    1. Can I get Hibernate to maintain this denormalized table automatically with relationships and collection mapping?
    2. Is this the best way to model a many-to-many graph when the concerns are good insert performance, excellent select performance (get ALL parents for a given node)?

Thanks!
Lance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2004 2:35 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It is not trivial and vendors have different solutions.
This article is interesting:
http://www-106.ibm.com/developerworks/d ... galla.html

But I am afraid this is too complicated for server side. Try to traverse and cache it with JAVA on client, if it is not to large to push/pop with stack.


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.