i have to dispaly all the subcategories of each category in my jsf page using JPQL. i have a table of Category( idCategory, name, idParent). How can i manage the jpql query, in order to show me ALL the Hierarchy of Category??
the SQL query is like bellow:
select root.name as root_name
, down1.name as down1_name
, down2.name as down2_name
, down3.name as down3_name
from category as root
left outer join category as down1
on down1.parent = root.category_id
left outer join category as down2
on down2.parent = down1.category_id
left outer join category as down3
on down3.parent = down2.category_id
where root.parent is null
order by
root_name
, down1_name
, down2_name
, down3_name
;
thanks.