0
How do I create a Criteria to list an object ordering by the longest date of a child object. In this scenario:
Domain:
class Entity {
List<Children> childrens;
}
class Children {
Date date
}
Something like this in SQL:
SELECT
*
FROM
entity
INNER JOIN
children c1 ON c1.entity_id = entity.id
WHERE
c1.date =
(SELECT MAX(c2.date) FROM children c2 WHERE c2.entity_id = c1.entity_id)
ORDER BY
c1.date DESC
you are using pure Jdbc, Ibernate, springboot or what?
– Franklin Barreto
Hibernate Criteria (https://www.devmedia.com.br/hibernate-api-criteria-realizingconsultations/29627)
– Victor Soares