-->
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.  [ 1 post ] 
Author Message
 Post subject: hql query help
PostPosted: Tue Jun 21, 2005 6:21 am 
Newbie

Joined: Wed Apr 13, 2005 8:10 am
Posts: 15
hi,
It would be great if some one could help me out in this query.

I have a resources entity with compound pk: key(string), locale(Locale)
where Locale is another entity.

I need to write a query which gives the key strings.

Code:
select res.id.key from Resource as res group by res.id.key


Now the problem: As a parameter I pass a list of Locale objects.
The query should count, for each key, how many resources exist whos id.locale is in the given list, and sort the result according to this number.

so I tried:
Code:
select r.id.key from Resource as r
  group by r.id.key
  order by
    count(select res.id.key from Resource res where res.id.locale in :locales)


but hibernate really didn't like that...

help would be most appreciated...

Thanx,
Ron
PS - hibernate 3.0
[/code]


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

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.