• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate, hierarchies, and nested sets

 
Jennifer Lautenschlager
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just curious, does anyone know of a good reference (or any reference) for using Hibernate and hierarchies and incorporating the idea of nested sets?

I'm not even sure what I want it to do, really, I'm just curious if there is a writeup on how someone has worked with nested sets and Hibernate in general. I'll leave it to the developer on the project to sort it out when he's back next week. I'm just an ex-developer at work who is still reasonably technically proficient and was curious about it.

What got me interested is a bug report I'm triaging. We have a fairly complex query that involves, as part of it, something along the lines of 'all foobars where the source node is a descendant of this node here', where there are hundreds of thousands of nodes in a (mostly static) hierarchy that is hundreds of levels deep. Doing this in a straight SQL query, leveraging nested sets, takes a couple of seconds. Doing this in Hibernate, using a one-to-many parent-child mapping that is also built into the database, takes about 8 or 10 minutes. Like I said, it's the developer who gets to sort it out, I was just curious if there were references on nested sets and Hibernate for me (who won't be dealing with it directly) to read out of curiosity.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just the normal Hibernate docs and reference materials. If it's a deep hierarchy there can be a lot of work, especially if it's all done using multiple queries.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic