-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to write HQL with these SQL
PostPosted: Sat Oct 30, 2004 10:58 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  
 
 Post subject: anyone here?
PostPosted: Tue Nov 02, 2004 12:42 am 
Newbie

Joined: Sat Oct 30, 2004 10:47 pm
Posts: 15
help me:-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 09, 2004 4:00 pm 
Beginner
Beginner

Joined: Thu Oct 14, 2004 9:50 am
Posts: 43
Same problem :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.