Hello, I have the following query:
List cases = Ebean.find(Case.class)
.fetch("scheduledAssignments")
.where()
...[snip]
.orderBy("scheduledStart")
.findList();
this results in the following sql:
select t0.caseid as c0, t0.scheduledstart as c1, t0.scheduledend as c2
, t1.locationid as c3
, t2.scheduledassignmentid as c4
from public.cases t0
join public.locations t1 on t1.locationid = t0.roomlocationid
left outer join public.scheduledassignments t2 on t2.caseId = t0.caseid
where ...[snip]
order by t0.scheduledstart
Notice there is only one order-by element. When I have multiple children (scheduledAssignments) it's possible that 2 cases that start at the same time will "interleave" and the case will be duplicated. Here's an example of some logging:
*** Loading case 40370 - 07:25-11:55
*** Loading case 40359 - 07:25-11:25
*** Loading case 40412 - 07:25-08:55
*** Loading case 40411 - 07:25-15:35
*** Loading case 40412 - 07:25-08:55
*** Loading case 40386 - 07:25-11:25
40412 has 2 child scheduledAssignments and appears twice in the list. (In this scenario I could solve the problem with a secondary sort on the end time, but the 2 cases could have the same end time as well.
When I use a FetchConfig query, there is no problem.