-->
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.  [ 1 post ] 
Author Message
 Post subject: Help With My Criterias
PostPosted: Thu Sep 20, 2007 11:14 am 
Beginner
Beginner

Joined: Tue Jul 04, 2006 11:29 am
Posts: 20
Location: Cambs, UK
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".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.