org.hibernate.hql.ast.QuerySyntaxException: cannot dereference scalar collection element: cspName
Code:
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 is object of map in Account class. cspName is key in map collection.
please suggest.