Sort child rows of each group in the desired order and take the desired number of top rows in each group in JPA
问题 Is it possible to sort child rows of each group (child rows of each parent row) in the desired order and take the desired number of top rows in each group in JPA? For example, I have three tables in MySQL database. category sub_category product The relationship between these tables is intuitive - one-to-many in the order in which they appear. I'm executing the following criteria query on the sub_category table. CriteriaBuilder criteriaBuilder=entityManager.getCriteriaBuilder(); CriteriaQuery