Criteria API doubly-nested subquery generates invalid SQL - missing subquery root

Description

A test case exists here:

A Criteria API query with a doubly-nested subselect results in invalid SQL being generated.

JPA model class snippet:

Query code:

Generated SQL:

Note missing root in the subselect.

Here's the full exception & trace from the test case:

Environment

None

Activity

Show:
Nathan Xu
August 28, 2020, 8:56 PM

After investigation, both this ticket and share the same solution. So I updated to include testing cases for both. One stone two birds!

Archie Cobbs
August 28, 2020, 9:03 PM

Glad to hear there is actually only one underlying bug. Thanks!

Nathan Xu
September 1, 2020, 3:52 PM

After investigation, it is decided a separate PR will be created for this ticket for it has different root cause and solution.

Nathan Xu
September 3, 2020, 5:50 PM

PR created at:

Assignee

Nathan Xu

Reporter

Archie Cobbs

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure