openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (OPENJPA-1110) Error using subqueries which tests expressions over collection of elements
Date Wed, 07 Apr 2010 15:48:33 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael Dick resolved OPENJPA-1110.
-----------------------------------

    Resolution: Invalid

Resolving as invalid per Catalina's comments. 

> Error using subqueries which tests expressions over collection of elements
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-1110
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1110
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.1
>         Environment: Ubuntu Linux  x86_64, Java 6u13
>            Reporter: Luis Fernando Planella Gonzalez
>
> I'm attaching a very simple application with an entity, User, and an enum, Role.
> The user has a collection of roles annotated with @PersitentCollection.
> However, I cannot filter by multiple roles at once.
> I know MEMBER OF works, but in the real use case, we have entities with enum collection
which may be filtered by several values, and each MEMBER OF generates a subquery.
> Here is how to reproduce:
> The user class:
> @Entity
> public class User {
>     @Id
>     private String username;
>     
>     @PersistentCollection(elementCascade=CascadeType.ALL)
>     private Collection<Role> roles;
>     ...
> }
> The query:
>     select u
>     from User u
>     where exists (
>         select u2.username
>         from User u2 inner join u2.roles r
>         where u2 = u
>         and r in (:a, :u)
>     ) order by u.username
> The error:
> Exception in thread "main" <openjpa-2.0.0-SNAPSHOT-r422266:776878 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: "Encountered "exists ( select u2 . username
from User u2 inner join u2 . roles r where u2 = u and r in" at character 29, but expected:
["(", ")", "*", "+", ",", "-", ".", "/", ":", "<", "<=", "<>", "=", ">", ">=",
"?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG", "BETWEEN", "BOTH", "BY", "CASE", "COALESCE",
"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", "LENGTH", "LIKE", "LOCATE", "LOWER", "MAX",
"MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "NULLIF", "OBJECT", "OF", "OR", "ORDER", "OUTER",
"SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING", "SUM", "TRAILING", "TRIM", "TYPE", "UPDATE",
"UPPER", "VALUE", "WHERE", <BOOLEAN_LITERAL>, <DECIMAL_LITERAL>, <IDENTIFIER>,
<INTEGER_LITERAL>, <STRING_LITERAL>]." while parsing JPQL "select u from User
u  where exists (    select u2.username    from User u2 inner join u2.roles r    where u2
= u    and r in (:a, :u) ) order by u.username". See nested stack trace for original parse
error.
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:51)
> 	at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:149)
> 	at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:657)
> 	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
> 	at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:953)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:939)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:86)
> 	at org.test.Test.main(Test.java:23)
> Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:776878 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
Encountered "exists ( select u2 . username from User u2 inner join u2 . roles r where u2 =
u and r in" at character 29, but expected: ["(", ")", "*", "+", ",", "-", ".", "/", ":", "<",
"<=", "<>", "=", ">", ">=", "?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG",
"BETWEEN", "BOTH", "BY", "CASE", "COALESCE", "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", "LENGTH",
"LIKE", "LOCATE", "LOWER", "MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "NULLIF",
"OBJECT", "OF", "OR", "ORDER", "OUTER", "SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING",
"SUM", "TRAILING", "TRIM", "TYPE", "UPDATE", "UPPER", "VALUE", "WHERE", <BOOLEAN_LITERAL>,
<DECIMAL_LITERAL>, <IDENTIFIER>, <INTEGER_LITERAL>, <STRING_LITERAL>].
> 	at org.apache.openjpa.kernel.jpql.JPQL.generateParseException(JPQL.java:12815)
> 	at org.apache.openjpa.kernel.jpql.JPQL.jj_consume_token(JPQL.java:12689)
> 	at org.apache.openjpa.kernel.jpql.JPQL.conditional_primary(JPQL.java:1949)
> 	at org.apache.openjpa.kernel.jpql.JPQL.conditional_factor(JPQL.java:1927)
> 	at org.apache.openjpa.kernel.jpql.JPQL.conditional_term(JPQL.java:1780)
> 	at org.apache.openjpa.kernel.jpql.JPQL.conditional_expression(JPQL.java:1742)
> 	at org.apache.openjpa.kernel.jpql.JPQL.where_clause(JPQL.java:1562)
> 	at org.apache.openjpa.kernel.jpql.JPQL.select_statement(JPQL.java:91)
> 	at org.apache.openjpa.kernel.jpql.JPQL.parseQuery(JPQL.java:63)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:2139)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:2126)
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:49)
> 	... 10 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message