-->
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: Hierrachy in hibernate query
PostPosted: Wed Jul 15, 2009 12:57 am 
Newbie

Joined: Wed Jul 15, 2009 12:15 am
Posts: 1
Quote:
hi,

I wanna get a hibernate query so that i can retrieve values from my table in a tree hierarchy.

I have the following tables
1) acc_chart
id name parent level
--------------------------------
1 schd null 0
2 P1 1 1
3 P2 1 2
4 P3 1 2
5 S1 2 3
6 A1 2 3
7 AS1 6 4
8 As2 6 4
9 K2 3 2
10 H2 3 2
11 S3 4 2

2) Another table having values for some entries in acc_chart.

acc_transaction

id chart_id amount
-------------------------
12 6 600
13 7 500
14 9 100


i wanna get the result in the form of a tree structure using hibernate query. The result should contain only the hierarchy of those nodes having values.

in tis case the structure will be like
schd
P1
A1
AS1
AS2
P2
K2


Can i get this in a single query.


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.