I do the fallowing HQL with NHibernate:
from Contact a where IsInternal = 0
this give me the fallowing sql (from NHProfiler):
select TOP ( 25 /* @p0 */ ) contact0_.Id as Id29_,
contact0_.ObjectVersion as ObjectVe2_29_,
...
...
from Contact contact0_
left outer join Company contact0_1_
on contact0_.Id = contact0_1_.Id
left outer join Person contact0_2_
on contact0_.Id = contact0_2_.Id
left outer join Branch contact0_3_
on contact0_.Id = contact0_3_.Id
left outer join ContactGroup contact0_4_
on contact0_.Id = contact0_4_.Id
where contact0_.IsInternal = 0
I want now extend the where-condition with
... and (contact0_1.Id is not null or contact0_2_.Id is not null)
The question is now, how can I access the joined table in the HQL?
Best Regards, Thomas
Er, if the field is null, then referenced object is null. So:
where IsInternal = 0 and (a.person is not null or a.company is not null)