-->
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 problem
PostPosted: Sat May 22, 2004 2:38 pm 
Newbie

Joined: Fri May 21, 2004 8:02 pm
Posts: 4
Hi,

This is the sql query I have which uses outer joins.

select a.muuid,a.forum_name,count(b.muuid) topics,sum(b.topic_noposts) posts,a.createddate from um_forum a left outer join um_topic b on b.forum_id = a.muuid group by a.muuid,a.forum_name,a.createddate order by a.forum_name,a.createddate desc

This is the HQL I have written. Please write me whether this HQL is correct or not.

select a.muuId,a.name,count(b.muuId),sum(b.postsNumber),a.createdDate from Forum as a,Topic as b join b.forumId left outer join a.muuId group by a.muuId,a.name,a.createdDate order by a.name,a.createdDate desc

What happens is that when test the application, hibernate create the following query

select forum0_.MUUID as x0_0_, forum0_.FORUM_NAME as x1_0_, count(topic1_.MUUID) as x2_0_, sum(topic1_.TOPIC_NOPOSTS) as x3_0_, forum0_.CREATEDDATE as x4_0_ from UM_FORUM forum0_, UM_TOPIC topic1_ group by forum0_.MUUID , forum0_.FORUM_NAME , forum0_.CREATEDDATE order by forum0_.FORUM_NAME , forum0_.CREATEDDATE desc fetch first 10 rows only


It doesnt refer outer joins in the created query.

Thanks in advance,
Umar


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.