This rather complicated query returns a list of 1 which contains a list of 1.
My question is, is that what we are asking for in the HQL or is it a bug? I didn't think Hibernate returned nested lists.
Code:
from Employment emp join emp.employmentSubstantiveRanks esr where
emp.personnel.id = :PERSONNEL_ID and emp.fromDate =
(select max(e.fromDate) from Employment e where e.personnel.id = :PERSONNEL_ID and ((e.toDate > :SYSDATE or (e.toDate is null))) and
esr.comp_id.fromDate = (select max(esr1.comp_id.fromDate)
from EmploymentSubstantiveRank esr1 join esr1.employment e1
where e1.personnel.id = :PERSONNEL_ID and e1.fromDate = (select max(e2.fromDate) from Employment e2 where e2.personnel.id = :PERSONNEL_ID and
((e2.toDate > :SYSDATE) or (e2.toDate is null))) and ((esr1.toDate > :SYSDATE) or (esr1.toDate is null)))
Thanks,
Christian Catchpole