HQL/JPQL size() does not work (anymore) with nested expression

Description

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)

Environment

None

Activity

Show:
Alexandre Jacob
April 10, 2020, 4:23 PM
Edited

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:

 

Alexandre Jacob
April 11, 2020, 9:22 AM
Sanne Grinovero
August 5, 2020, 2:10 PM

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

Assignee

George Katiforis

Reporter

Alexandre Jacob

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.4.12

Components

Affects versions

Priority

Critical
Configure