How can I do a left out join two tables while specifing criteria for the table being outer joined to?
In regular SQL i would do something like:
select tabA.*, tabB.*
from tableA as tabA left outer join tableB as tabB on (tabA.id = tabB.parentId and tabB.type = 'X')
in HQL I don't think I can use the ON keyword so I think my only option is:
select tabA, tabB
from tableA as tabA left outer join tabA.bees as tabB
where (tabB.type = 'X' or tabB.type is null)
Is this correct... or is there a more elegant way?
Thanks,
Paul
|