Yesterday, I upgraded my NHibernate application from 1.2 to 3.0. I get the following exception
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_dat开发者_Python百科e BETWEEN c.ContractStartDate AND c.ContractEndDate)]
I can't seem to fix this problem... any suggestion?
The HQL syntax is incorrect. Use:
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)
精彩评论