Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1
Hi,
I have a class Reservation with a list of Payment objects:
Code:
class Reservation{
...
List<Payment> payments
...
List getPayments(){
...
}
}
class Payment{
float amount;
}
both annotated/mapped in hibernate.
what I need is to get a report query which gives me all Reservations where the sum of the amounts of payments of that Reservation are greater than 0 (or another amount).
Actually it's a report query where I have to filter dynamically on other fileds of Reservation as well, thus I want to use Criteria.
a sql query which would give me the expected result would be something like
Code:
select reservation.* from reservation join payment on reservation.id = payment.reservation_id group by reservation.id having sum(payment.amount) > 3
other where clauses are needed to filter on other fields of reservation (customer, date, ..)
I have read through documentation but couldnt find a way to chieve this via Criteria, can you help me because I am quite stuck.
Thanks in advance
Francesco