Hibernate version: 1.0.2.4000
hi,
I'm working on a project using NHibernate and the UML Model I Work with is the following :
[Contact]--->[Phone]--->[PhoneType] where PhoneType can be one of the following values :
* Personal
* Business
I try to write an HQL Query that returns all the contacts associated with their potential business phone number.
-----------------------------------------------------------------------------
Considering the documentation, it shoud look like this exept the LEFT JOIN part where "ON" are not allowed :
SELECT Contact.LastName, Contact.FirstName, BPhone.Number
FROM Contact Contact
LEFT JOIN Contact.Phones BPhone ON Phone.PhoneType.Name = 'Business'
-----------------------------------------------------------------------------
Then I tried this HQL query :
SELECT Contact.LastName, Contact.FirstName, BPhone.Number
FROM Contact Contact
LEFT JOIN Contact.Phones BPhone
WHERE BPhone.PhoneType.Libelle = 'Business'
But the proble then is that the "WHERE" filter removes all the contacts not having business phone.
------------------------------------------------------------------------------
Could anyone tell me how I shoud do to return the right result please.
Thank you for any answer.
|