I have a HQL something like
Code:
select new OrderInfo(o.id, o.orderDate, o.buyer, sum(i.quantity) from Order o left join o.orderItems i where o.buyer.id = :userId ...")...
and I have an OrderInfo constructor
Code:
public OrderInfo(Integer id, Date orderDate, User buyer,
int numberOfItems) {
...
}
I get a run-time error: "Unable to locate appropriate constructor". The error doesn't occurs if you replace the sum function with an integer.
I can't find a related document for the subject. Or, I don't use the aggregate function correctly.