Criteria API generates invalid JPQL for condition based on count subquery

Description

My model has three entities:

  • Taxi

    • shift : Shift

  • Driver

    • taxi : Taxi

  • Shift

    • shiftsPerDay : int

The following query in JPQL works fine:

however if I try to use the JPA criteria API:

it results in invalid JPQL:

whereas this would be correct (note "select(count(...))" instead of "count(select ...)"):

Environment

None

Assignee

Unassigned

Reporter

Rafael Chaves

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure