-->
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.  [ 2 posts ] 
Author Message
 Post subject: Association Order By
PostPosted: Sun Jan 31, 2010 2:06 pm 
Newbie

Joined: Fri Jan 29, 2010 8:37 am
Posts: 5
Hi to all,
i wrote the following HQL query:

Code:
select parent.childs from DbParent parent where parent.id=:id

which return a list of Child entities.
The child entity has a "value" property, and I'd like to order the results of the HQL query upon the "child.value" property.
I wonder how to achieve this in hql syntax.

Thanks


Top
 Profile  
 
 Post subject: Re: Association Order By
PostPosted: Mon Feb 01, 2010 3:35 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Try something like this:
Code:
select c from DbParent parent join parent.childs as c where parent.id=:id order by c.value


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.