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.