-->
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.  [ 5 posts ] 
Author Message
 Post subject: HQL: left join unrelated tables - impossible???
PostPosted: Thu Sep 01, 2005 2:15 pm 
Newbie

Joined: Tue May 03, 2005 7:13 pm
Posts: 4
Yes, I want to use left join on unrelated tables in HQL.
Is this possible at all?
(by "unrelated" I mean that the tables do not have association in mapping)

Great thanks!


Top
 Profile  
 
 Post subject: Re: HQL: left join unrelated tables - impossible???
PostPosted: Thu Sep 01, 2005 2:37 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
nkarasev wrote:
Yes, I want to use left join on unrelated tables in HQL.
Is this possible at all?
(by "unrelated" I mean that the tables do not have association in mapping)

Great thanks!


You can't specify the "join" in HQL since joins are done on associations but you should get the same results using a query like this.

Code:
select .... from ObjectA a, ObjectB b where a.someId = b.someId

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 3:19 pm 
Senior
Senior

Joined: Tue Jan 11, 2005 5:03 pm
Posts: 137
Location: Montreal, Quebec
Quote:
You can't specify the "join" in HQL since joins are done on associations but you should get the same results using a query like this.


The where clause as shown here act like an "Inner Join", nkarasev want to do a Left Outer Join.

I dont see how Hibernate can do an Left Join... Is that possible? It is still a trivial query. I have exacly the same issue with Hibernate. Must we map all possible join between Pojo to be able to use te left join?

Etienne.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 7:23 pm 
Newbie

Joined: Tue May 03, 2005 7:13 pm
Posts: 4
Thanks to all who answered!

I really needed LEFT join, so I take it as I need to resort to other
means of getting my task solved.

Cheers.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 02, 2005 9:24 am 
Senior
Senior

Joined: Tue Jan 11, 2005 5:03 pm
Posts: 137
Location: Montreal, Quebec
Hi,

I just got this reply confirming that outer join is not possible between unrelated table.

http://forum.hibernate.org/viewtopic.php?p=2259206#2259206

it is quite suprizing for a persistence layer (as good) as Hibernate.

Etienne.


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