I have two JPA entities :
- Schedule (containing a list of reservations)
- Reservation (containing a Date field : Date resDate)
My goal is to only retrieve reservations matching a date parameter (planningDate) while retrieving all schedules no matter if the reservation exists or not at this given date.
So I wrote :
SELECT s FROM Schedule as s LEFT JOIN s.reservations as r WHERE r.resDate = :planningDate order by s.startHour
Why aren't schedules, without reservations on this date, retrieved despite my LEFT JOIN ?
Probably, like native queries, LEFT JOIN looks like INNER JOIN when combining with a WHERE clause.
So, how could the query be changed to fulfill my requirement ? I haven't found a specific feature in JPQL.