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: Filtering outer joined collection in HQL
PostPosted: Tue Aug 29, 2006 12:55 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Using NHibernate 1.0.2

I have a query where I would like select contacts, with their cell phone numbers if they have one. My Contact entity has a Phones collection, and each Phone entity in that collection has a PhoneType property.

So, I tried this:

SELECT Contact.Name, CellPhone.Number
FROM Contact
LEFT JOIN Contact.Phones AS CellPhone
WHERE (CellPhone.PhoneType = 'Cell' OR CellPhone.PhoneType IS NULL)

However, it only returns contacts that either have a cell phone, or have no phone at all. It doesn't return contacts that have one or more non-cell phones but no cell phone. I want to get a row back whether or not the contact has a cell phone.

How do I do this? In SQL, the "PhoneType = 'Cell'" criteria would go in the ON clause of the join, but that's not possible in HQL ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 2:50 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Nevermind ...

http://jira.nhibernate.org/browse/NH-514


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 4:10 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
To All: If this issue affects you, please vote for the JIRA entry to urge the NHibernate team to fix it sooner rather than later. Thanks.


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.