-->
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: How to write HQL with this statement
PostPosted: Thu Nov 04, 2004 10:54 pm 
Newbie

Joined: Sat Oct 30, 2004 10:47 pm
Posts: 15
String query = "select {profile_.*}, count(message.userID) as i from Forum forum_ inner join ForumMessage message on message.forumID=forum_.forumID "
+ " inner join profile {profile_} on message.userID={profile_}.id"
+ " group by message.userID order by i desc ";

I use the statement :
Query hibernateQuery = session.createSQLQuery(query, "profile_", Profile.class);
to execute the query, cause it seems I can not give an alias to count(...) value in HQL?

There are domain objects : Profile, Forum, ForumMessage,and I want to get user profiles order by their posted messages count.

Thanks.


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.