Query in hibernate hbm.xml
Table structure
Table1
ID Name Type Parentid
123 s a 124
124 r b 125
125 t a 123
If the type is a
, I should get the parent id
and get
the name of that parent id.
How to write the query in hibernate hbm.xml file开发者_如何学Go..
SO that i can map in the mapping bean and display it in frontend. I am using ExtJS grid
as frontend and POstgres
as backend.
Please help.
SELECT distinct parent.name FROM Parent parent WHERE parent.id in (SELECT table1.Parentid FROM Table1 table1 WHERE table1.Type = 'a');
With this query you'll find all parent names for all entities in table1 with type a.
精彩评论