HQL to JPQL Question

What is the translation of the following HQL query into EclipseLink compatible JPQL:

select p from NameList list, Person p
where p.name in elements(list.names)

(this is just a variant of an example HQL query taken from here )

In EclipseLink, the IN function does not seem to accept property paths:

Internal Exception: NoViableAltException(36!=[693:1: inExpression[boolean not, Object left] returns [Object node] : (t= IN n= inputParameter | t= IN LEFT_ROUND_BRACKET (itemNode= inItem ( COMMA itemNode= inItem )* | subqueryNode= subquery ) RIGHT_ROUND_BRACKET );])

Perhaps I could solve this with another connection, but is there something more compact?

+3
source share
1 answer

I found a solution:

select p from NameList list, Person p
where p.name member of list.names

This solution complies with JPA 2 requirements.

+3
source

Source: https://habr.com/ru/post/1747419/


All Articles