升级到NHibernate 3.0.0.1002,表未映射

时间:2010-09-29 15:25:32

标签: nhibernate hibernate exception nhibernate-mapping nhibernate-3

昨天,我将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)]

我似乎无法解决这个问题......有什么建议吗?

1 个答案:

答案 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)