开发者

HQL to JPQL question

开发者 https://www.devze.com 2023-01-01 12:03 出处:网络
What is the translation of the following HQL query to EclipseLink compliant JPQL : select p fr开发者_Go百科om NameList list, Person p

What is the translation of the following HQL query to EclipseLink compliant JPQL :

select p fr开发者_Go百科om NameList list, Person p
where p.name in elements(list.names)

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

In EclipseLink the IN function doesn't seem to take 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 );])

I could probably solve this with another join, but is there something more compact?


I found the solution :

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

This solution is JPA 2 compliant.

0

精彩评论

暂无评论...
验证码 换一张
取 消