2010-10-22 146 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)。这应该够了吧。