-->
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: join in scalar query
PostPosted: Thu Dec 18, 2003 7:38 am 
Newbie

Joined: Tue Dec 16, 2003 6:38 am
Posts: 5
Hi,

Is there a way to force the implicit use of "left outer joins" in scalar queries?

For example, if I have this query:

"select cat, cat.mate.name from DomesticCat cat"

the result set won't contain cats that do not have mates.

But what I want is to have null returned as the mate's name,
when the cat doesn't have a mate.
And I want to achieve this WITHOUT using an explicit left join
in the from clause of the query like this:

"select cat, mate.name from DomesticCat cat left join cat.mate as mate"

Is this possible?

Thank you,
Teodor


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 7:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No. You must use an explicit join if you want an outer join


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 2:56 pm 
Newbie

Joined: Tue Feb 17, 2004 2:51 pm
Posts: 10
Are there any special difficulties stopping the implementation of this?

It should be enough information in the mapping file to do implicit outer joins from scalar queries?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 3:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't see why this would be useful. Plus, it corrupts the well-established semantics of HQL implicit join.

Not going to happen, sorry.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 18, 2004 5:51 am 
Newbie

Joined: Tue Feb 17, 2004 2:51 pm
Posts: 10
Thanks for your quick reply!

If scalar HQL queries supported implicit outer-joins it would make it simpler for applications for dynamically generate HQL queries. Right now we would need to go down and check the ClassMetadata in order to generate HQL queries with outer joins. The query itself also becomes more complex. Wouldn't it be more consistent if scalar queries also honored the outer-join="true" parameter?


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.