开发者

HQL to JPQL question

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜