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
|