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: Report Query translation question
PostPosted: Tue May 15, 2007 6:27 am 
Newbie

Joined: Tue May 15, 2007 6:17 am
Posts: 1
I'm trying to make a report query that shows how many distinct entities appear a certain number of times, so that I can make a graph of it showing the number of appearances against the number of entities.
The result of the query should be a table like :
Code:
#appearances | #entities
-----------------------------
      12        |       1
      10        |       2
       5        |       15
       2        |       37


I created a SQL-query of the following form:

Code:
select count(count_ent) as freq, count_ent from
(
select count(ent_name) count_ent from tbl_entity
group by ent_name
) as tbl1
group by count_ent
order by freq desc, count_ent desc;



Can this query be translated into HQL?
In a Criteria-query?
How?

I've read in the documentation and in "Hibernate in Action" that subqueries are not supported in the from-clause, but I don't know how to do this query otherwise.

Any help is appreciated.


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.