【发布时间】:2011-09-02 20:04:41
【问题描述】:
我使用 NHibernate 进行休闲 HQL:
from Contact a where IsInternal = 0
这给了我闲置的 sql(来自 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
我现在想用
扩展 where 条件 ... and (contact0_1.Id is not null or contact0_2_.Id is not null)
现在的问题是,如何访问 HQL 中的连接表?
最好的问候,托马斯
【问题讨论】:
标签: nhibernate join hql left-join where-clause