HQL recursion, how do I do this?
Posted
by niklassaers
on Stack Overflow
See other posts from Stack Overflow
or by niklassaers
Published on 2010-03-21T10:47:47Z
Indexed on
2010/03/21
10:51 UTC
Read the original article
Hit count: 508
Hi guys,
I have a tree structure where each Node
has a parent and a Set<Node> children
. Each Node has a String title
, and I want to make a query where I select Set<String> titles
, being the title of this node and of all parent nodes. How do I write this query?
The query for a single title is this, but like I said, I'd like it expanded for the entire branch of parents.
SELECT node.title FROM Node node WHERE node.id = :id
Cheers
Nik
© Stack Overflow or respective owner