Hibernate version: 3.2
Hi all,
My brain is a bit frazzled today. It's been a while since I've touched Hibernate's criteria classes so I can't think how to do this today. Would anyone mind pointing me in the right direction.
Here's the SQL query I can use to get the right results:
Code:
select * from path_walker where id not in (select distinct parent_id from path_walker where parent_id is not null)
How would I put this into criteria objects though?
A little info on what I am trying to do. Path_Walker is represents a tree structure of a few elements. Here's some structure and example data:
Code:
id | name | parentId
-----------------------------
1 | parent | null
2 | subdirA | 1
3 | subdirB | 1
4 | subdirC | 3
5 | subdirD | 3
This translates into a tree with "parent" as the top level node. That has two child "subdirA" and "subdirB". subdirB also has two children "subdirC" and "subdirD". What I'm trying to get is a list of all the items at the bottom of the tree. In this case "subdirC" & "subdirD".