-->
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: outer joins in HQL
PostPosted: Tue May 25, 2004 3:47 am 
Newbie

Joined: Tue May 25, 2004 2:48 am
Posts: 2
Hi,

I have a class (and table) A with a many-to-one relationship to class (and table) B with key b.

Code:
<class name="A" table="A">
  ...
  <many-to-one name="b" class="B"
    <column name="b"/>
  </many-to-one>
</class>


Now I want to query all B's together with the A's pointing to it, which match a certain condition (c). Because for some B's there might be no A which match (c) I have to use an outer join. In SQL it's very easy:

Code:
select * from B left outer join A
on B.b = A.b
and (c)


Because of the outer join I can't put (c) in a where clause. I this case I wouldn't get the B's without A (at least on DB2)

I have no Idea how to express this query in HQL. In HQL I can only write:
Code:
from A x right outer join x.b

The problem is the additional condition (c). I can't put it in the where cluase and I can't influence the "on" clause. Any Ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 18, 2004 3:46 pm 
Newbie

Joined: Fri Nov 28, 2003 9:08 am
Posts: 19
Location: Brasil
Hi ulli,

I was searching for and answer for the same problem, when I found your post.
Have you resolved this? How?

Tks
Felipe


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 21, 2004 3:01 am 
Newbie

Joined: Tue May 25, 2004 2:48 am
Posts: 2
Hi Felipe,

sorry, no I haven't solved the problem yet. I tried other sources (newsgroups etc) but I didn't get any answer. But because it's a real showstopper for us we're now thinking about kicking Hibernate out of the project (Another option is moving from DB2 to Oracle)

Greetings
ulli


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.