-->
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.  [ 6 posts ] 
Author Message
 Post subject: HQL join question
PostPosted: Mon Jan 26, 2004 5:30 pm 
Newbie

Joined: Mon Jan 26, 2004 5:24 pm
Posts: 2
Hello,

I've been trying to get something to work without success. Here's a simple example:

I have two Hibernate classes: A and B. Each has its own table in the database.
A has some attributes, and has a foreign key to B. It does not, however, have a hibernate relationship to B in A's mapping file. Only a foreign key stored as a Long value.

The question is, how can I do a HQL query that selects attributes from both A and B?
I tried something like:

select a from A as a join B as b where a.fkey = b.id

That gives me the exception:

"outer or full join must be followed by path expression..."

How can I do this without adding the association to the Hibernate mapping file?


Thanks!
Chris


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:32 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Cartesian product and theta-style join on the product:

Code:
from A as a, B as b where a.fkey = b.id

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:43 pm 
Newbie

Joined: Tue Aug 26, 2003 9:52 am
Posts: 15
How do you use an left ou right outer join that ?

Thanks.
Alain


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Not possible.


Top
 Profile  
 
 Post subject: Re: HQL join question
PostPosted: Thu Aug 27, 2009 3:01 am 
Beginner
Beginner

Joined: Wed Aug 22, 2007 5:53 am
Posts: 38
Is Theta Style outer join possible in latest version of hibernate ?


Top
 Profile  
 
 Post subject: Re: HQL join question
PostPosted: Thu Aug 27, 2009 9:20 am 
Beginner
Beginner

Joined: Fri Nov 11, 2005 4:35 pm
Posts: 23
Nope.

Every day you will see some posts into this forum from developers who needs this functionality.
Hibernate does not support this, openJPA does.

Does anybody know why hibernate doesn't support that?

Thanks in advance,
Pieter


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