2010-10-22 208 views
2

org.hibernate.hql.ast.QuerySyntaxException:無法提領標量集合元素:cspName休眠異常

st.append("SELECT customers.name,sum(csp.cspValue) as TotalMoney "); 
      st.append("from Account as account "); 
      st.append("left join account.CSPFields as csp with ((account.accountID=csp.id) and (csp.cspName = 'Target')) "); 
      st.append("left join Customers as customers"); 
      st.append("with account.customerExec.id=customers.id "); 
st.append("where (account.accountDate between :startDate and :endDate) "); 
      st.append("and (account.accountBatch.id in (:acIDs)) "); 
      st.append("group by customers.name"); 

CSPFields是在帳戶類映射的對象。 cspName是地圖收集中的關鍵。

回答

0

HQL在涉及對象時區分大小寫,您的ACCOUNT實體是否全是大寫?如果您發佈了您的客戶和帳戶實體,這可能會有所幫助。

0

你可以嘗試使用元素(account.CSPFields)。這應該夠了吧。