JPA @Query with 'case when exists' does not work with Hibernate JPA @Query with 'case when exists' does not work with Hibernate postgresql postgresql

JPA @Query with 'case when exists' does not work with Hibernate


JPA 2.1 CASE expression only supports scalar expressions, not queries.

For more details, check out the JPA specification.

If the DB supports this syntax, you need to use a native SQL query instead.