使用MEMBER OF作为持久化实体和持久化实体集合

时间:2015-08-21 15:05:34

标签: collections jpql contains

SELECT d
FROM YYY d
WHERE d MEMBER OF :parameter.myCollection

该查询有什么问题?参数是我在上一步中从数据库中检索的实体。我一直得到以下例外:

org.apache.openjpa.persistence.ArgumentException:"遇到" d成员:"在角色18,但预期:["("," *"," +"," - ",&# 34;。"," /",":","<","< =" ,"<>"," =",">","> =",&#34 ;?"," ABS"," ALL"," AND"," ANY"," AS&#34 ;," ASC"," AVG"," BETWEEN"," BOTH"," BY",&#34 ; CONCAT"," COUNT"," CURRENT_DATE"," CURRENT_TIME"," CURRENT_TIMESTAMP"," DELETE" ," DESC"," DISTINCT"," EMPTY"," ESCAPE"," EXISTS"," FETCH"," FROM"," GROUP"," HAVING"," IN"," INDEX", " INNER"," IS"," JOIN"," KEY"," LEADING"," LEFT& #34;," LENGTH"," LIKE"," LOCATE"," LOWER"," MAX",& #34;会员"," MIN"," MOD"," NEW"," NOT"," NULL&# 34;," OBJECT",& #34; OF"," OR"," ORDER"," OUTER"," SELECT"," SET&# 34;," SIZE"," SOME"," SQRT"," SUBSTRING"," SUM",&# 34; TRAILING"," TRIM"," TYPE"," UPDATE"," UPPER"," VALUE&#34 ;," WHERE" ,,,,,,,,,]。"解析JPQL" SELECT d     从YYY d     在哪里成员:parameter.myCollection &#34 ;.有关原始解析错误,请参阅嵌套堆栈跟踪。     在org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:51)     在org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:154)     at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672)     at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:654)     在org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:620)     在org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:682)     在org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:589)     在org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1037)     在org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1016)

1 个答案:

答案 0 :(得分:0)

检查出来:

SELECT d
FROM YYY d
WHERE d IN :parameter.myCollection

如何使用'MEMBER OF'和'IN'的说明是here