昨天,我将NHibernate应用程序从1.2升级到3.0。我得到以下异常
c.SubContractors is not mapped [SELECT count(distinct c) FROM CallUp c, c.SubContractors sc Where sc.id = :id AND c.ChildCallUp IS NULL AND c.State > 0 AND (:start_date BETWEEN c.ContractStartDate AND c.ContractEndDate OR :end_date BETWEEN c.ContractStartDate AND c.ContractEndDate)]
我似乎无法解决这个问题......有什么建议吗?
答案 0 :(得分:0)
HQL语法不正确。使用:
SELECT count(distinct c)
FROM CallUp c JOIN c.SubContractors sc
WHERE sc.id = :id
AND c.ChildCallUp IS NULL
AND c.State > 0
AND (:start_date BETWEEN c.ContractStartDate AND c.ContractEndDate
OR :end_date BETWEEN c.ContractStartDate AND c.ContractEndDate)