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]