The size() HQL/JPQL expression does not work anymore with nested path.
Given the following entities:
(TL;DR: a student can have a teacher (N - 1) a teacher can have multiple skills (N - N))
I expect the following query:
To translate into:
(this is the query generated by version 5.4.12)
While it translates into:
(since version 5.4.13 the where condition is not the good one anymore)
The subquery is comparing student.id (instead of teacher_id) against teachers_id.
I think this is related to work done in (introduction of CollectionSizeNode)
I attached (2 by mistakes) test case with a test as described in the description of the ticket.
In the test, you can see that the non nested version of the query gives the expected sql:
While the nested one doesn’t:
I’ve added tests : https://github.com/ajacob/hibernate-orm/commits/HHH-13944
hi , are you working on a fix? Need any help? I’m also looking for a fix, but don’t want to step on your toes if you’ve made progress.
Thanks