1
查詢基類時,NHibernate將爲每個基類的子類創建一個左外連接。即使查詢僅限於基礎屬性,並且在這些屬性上設置了投影,也會發生這種情況。如何防止nhibernate爲子類創建左外連接
例子:
SELECT this_.Id as y0_, this_.Name as y1_ FROM AnimalBase this_
left outer join Dog this_1_ on this_.Id=this_1_.AnimalBaseFK
left outer join Cat this_2_ on this_.Id=this_2_.AnimalBaseFK
WHERE lower(this_.Name) like @p0;@p0 = '%rover%'
我的問題是如何改變這種默認行爲?
感謝
編輯:
看吧:
How to perform a non-polymorphic HQL query in Hibernate?
謝謝弗雷德裏克。您提供的鏈接使我得到了更好的鏈接:http://stackoverflow.com/questions/2093025/how-to-perform-a-non-polymorphic-hql-query-in-hibernate/2094321#2094321 – 2011-02-04 09:18:53