Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.2
I am trying to do a group by query order as
select aorder.customer.id, sum(a.order.amount) from CustomerOrder aorder group by aorder.customer.id
it works perfectly. However if i want to sort the result order by the result of sum, it does not work. the query as
select aorder.customer.id, sum(a.order.amount) as totalAmount from CustomerOrder aorder group by aorder.customer.id order by totalAmount desc.
Can anyone help this out? Obviously I can put the result in a object and sort the list in java code. But I really want to know the way it works in Hibernate.
Thanks