-->
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.  [ 2 posts ] 
Author Message
 Post subject: Left joins
PostPosted: Thu May 20, 2004 8:36 am 
Newbie

Joined: Wed Mar 24, 2004 6:18 am
Posts: 15
Hi everyone!

I have a table "myTable" with a one-to-many relationship with "myOtherTable". "myOtherTable" has also a many-to-one relationship with "yetAnotherTable".

When I execute this query:

Code:
      
select p.id, myOthers from myTable p left outer join p.myOtherTables as myOthers


I get the id of "myTable" objects, whether they have "myOtherTable" elements or not, as a consequence of the left join.

But with this query:

Code:
      
select p.id, myOthers.yetAnotherTable from myTable p left outer join p.myOtherTables as myOthers


I just get the id of "myTable" objects that have "myOtherTable" childs.

Is there any way to get the behaviour of the first query with the second? Or I'm forced to pick the whole "myOtherTable" objects?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Look at the generated SQL and you will see why it is that way.


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