-->
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: HQL equavilent of table join with multiple on conditions
PostPosted: Sun Sep 30, 2007 7:17 pm 
Newbie

Joined: Sun Sep 30, 2007 7:08 pm
Posts: 4
Hi all,

Can some one give me some help on how to write a HQL of the following SQL:
Code:
select c.name, count(i.id)
  from category c
  left join item i on i.category_id=c.id
  left join auction a on a.item_id=i.id and a.is_running=true
  group by c.name;


I attempted to write the following HQL, but it doesn't return the same result:
Code:
select c.name, count(i.id) from Category c
  left c.items i
  left i.auction a
  where a.running=true
  group by c.name


The problem I have is that SQL has two conditions after ON keyword with no where clause. I don't see clear documentation on how to write this with HQL. Can you help?

Thanks.
/thebugslayer[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 2:13 pm 
Newbie

Joined: Sun Sep 30, 2007 7:08 pm
Posts: 4
Hi all,
I still don't have resolution with this problem. Is there any Hibernate user who can help me out here?

Thanks,
-Z


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 2:31 pm 
Newbie

Joined: Sun Sep 30, 2007 7:08 pm
Posts: 4
Never mind, I found it. "with" keyword is used.
http://www.hibernate.org/hib_docs/refer ... ryhql.html


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.