This is an odd request but one of our queries works fine in SQL but it is unable to fetch the results in Hibernate.
The following is the structure:
Booking {
ID Long,
PaymentDate Date,
EmployeeID Int,
.
.
.
}
We want to query for records of the Employees, for how many bookings created versus of those bookings how many were sold.
So we need to do a left join on booking.
The following is the sql query:
select b1.employeeid, count(b1.Id), count(b2.Id) from Booking b1 left join Booking b2 where b1.Id = b2.Id group by b1.employeeid;
We do a similar query in HQL but it gives an error.
|