为什么 NHibernate 翻译这个 HQL:
select count(*) from TeacherResource as tr
inner join fetch tr.Product as pr
where pr.CatalogTitle like '%ame%'
进入这个无效的 SQL(包括 where 子句但省略了表连接):
select count(*) as col_0_0_
from TeacherResources teacherres0_
where product1_.CatalogTitle like '%ame%'
以及如何执行将按预期运行的计数?
这是实体的相关部分:
Public Class TeacherResource
Public Overridable Property TeacherResourceId As Guid
Public Overridable Property Product As BvCustomProduct
End Class
和映射:
<class name="TeacherResource" table="TeacherResources">
<id name="TeacherResourceId">
<generator class="guid"/>
</id>
<many-to-one name="Product" column="ProductBvin"/>
</class>