-->
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: Is Modified Preorder Tree Traversal possible?
PostPosted: Wed Oct 17, 2007 8:51 am 
Newbie

Joined: Wed Oct 17, 2007 8:36 am
Posts: 1
I've run into a bit of a problem.

The project I'm working on needs to store very large hierarchical tree data. Often we'll need to retrieve an entire tree from our database. The way the program is set up uses the Adjacency List method for store trees (Records have parent columns to store their relationships). This seems to be the way that it's done it Hibernate, I haven't found an example of a parent-child relationship in any other way so far.

When attempting to retrieve an entire tree of several thousand entities, I've noticed that the system needs to make several thousand SQL queries as each record needs a query to check for children. Currently on our dataset, that can take about 20-30 minutes to retrieve a single tree. It's not really a fault of Hibernate, it would be just as slow in JDBC, but more of a database design issue I think.

I'd like to modify the database to use a Modified Preorder Tree Traversal (http://www.sitepoint.com/print/hierarchical-data-database) to store and retrieve the data, as this would make retrieving a tree or any subtree performable with a single SQL query. Updates, Inserts, and Deletes would be a bit slower, but those are done gradually over time and I think not as much of an issue.

Does anyone know of a way to implement a Modified Preorder Tree Traversal in Hibernate? Am I looking at this incorrectly or perhaps using what comes with Hibernate in an inefficient manner? I've been scouring the 'net, but I haven't had much luck on this front. Any help would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 10:52 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://fisheye.jboss.com/browse/~raw,r= ... ckage.html

http://fisheye.jboss.com/browse/JBoss/j ... /nestedset

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Is Modified Preorder Tree Traversal possible?
PostPosted: Wed Sep 17, 2008 3:18 pm 
Newbie

Joined: Fri Aug 29, 2008 2:31 pm
Posts: 4
Thanks for the link to the nestedset package(s). I am trying to implement the overlay strategy outlined there, but the NestedSetDelegates for my entities do not appear to be doing anything. It appears that the Listener for inserts is not hearing about insertions.

Here's my question: how do I correctly configure my hibernate.config.xml to set the post insert listener to NestedSetPostInsertEventListener? I tried:


<property name="hibernate.ejb.event.post-insert">org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener</property>

But Hibernate references don't list any such property, or any similar property, so is it simply not possible to configure hibernate.config.xml as desired?

Thanks,

Josh Britton


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2008 3:45 pm 
Newbie

Joined: Fri Aug 29, 2008 2:31 pm
Posts: 4
Never mind. I now now about the event tag! But I am still wondering if it is even possible to use the nestedset classes outside an ejb environment?


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.