-->
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: Using criteria API for a self join on single table
PostPosted: Thu Jan 17, 2008 1:03 pm 
Newbie

Joined: Thu Jan 17, 2008 12:50 pm
Posts: 1
Suppose I have a table PERSON as follows

PERSON
---------
ID -> PK
NAME
REF_ID
PARENT_REF_ID

with the sample data as follows

ID-----NAME-----REF_ID-----PARENT_REF_ID
100----A----------200---------NULL (If null then it is the root/parent record)
101----B----------201---------200 (Refers to A)
102----C----------202---------201 (Refers to B)
103----D----------203---------202 (Refers to C)
104----E----------204---------200 (Refers to A)

And the parent child relationship between the records by self join is as follows
A -> B -> C -> D
A -> E

Can anyone please tell me if we can acheive this parent-child heirarchy relationship using creiteria and how?


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.