2010-11-03 12 views
4

我需要構建一個HQL查詢,它使用同一個實體兩次,但使用來自先前實體的不同的約束。NHibernate連接可以從兩個獨立的實體中約束嗎?

例如:

select count(distinct a.id), 
    count(disintct b.id), 
    count(distinct c.id) 
from 
    EntityA a 
left join a.Children b 
left join a.Children c with c.SomeConstraint = b.SomConstraint 

然而,當我嘗試這樣做,我得到一個例外,說,我有我的條款與兩個實體。

如何在HQL中表達這個概念?

回答

2

您現在無法在HQL中執行此操作。

如果您的with子句中,當前允許的唯一事物是加入的實體和您加入的實體。

相關問題