HQL and dialects
Hi. I've been trying to write this query in HQL:
Code:
select t.name,count(phones)
from employee t
left outer join t.phone_numbers phones on
(phones.employee.id=employee.id and employee.name like 'C%')
i.e, extract all the employees and their number of phones, wheter they have phones or not, with a given condition.
But HQL does not support the keyword "on", I think, although Postgresql (my RDBMS of choice) does. If I write a condition in the "where" clause, then I don't get all the employees.
But then I came to the HQL chapter on the documentation, and this line caught my attention:
Quote:
"The next query uses the MS SQL Server isNull() function to return all the accounts and unpaid..."
Apparently it's invoking a native SQL function from HQL. Can I take benefit from the underlying RDBMS in my HQL code? The only thing I've found about dialects on the docs is this, which hasn't resolved my doubts:
http://www.hibernate.org/hib_docs/refer ... l-dialects
I would very much appreciate help on this, since now I'm writing some horrid code that I would love to avoid.