Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to write HQL to retrive Child object(From list) on the basis of Parent?

 
Navnath Kumbhar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There,
I have Class structure as following


There is Hibernate mapping created for this structure.
Three tables are created for this mapping
tbl_parent
tbl_lstChild
tbl_child

Now I want to fetch Child object where I have parent object with me.
Query in simple SQL is
select * from tbl_child tc inner join tbl_lstChild tlc on
tc.id=tlc.child_id where tlc.id=123
Above query is working fine.
Now How do I write same query in Hibernate(HQL)?
Please hel me

Thank You in advance.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show your query and tell us why it is not working (properly)?
 
Navnath Kumbhar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for replay.
I have resolved it.
Query is
select lc from Parent p inner join p.lstChild lc where p.strId=? and lc.name=?

Thank You.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic