You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (Closed) (JIRA)" <ji...@apache.org> on 2012/02/02 18:05:00 UTC
[jira] [Closed] (OPENJPA-1923) Allow flexible (non-standard) syntax
for collection-valued parameters in IN() expresseion of JPQL query
[ https://issues.apache.org/jira/browse/OPENJPA-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Albert Lee closed OPENJPA-1923.
-------------------------------
Close issue in preparation for 2.2.0 release.
> Allow flexible (non-standard) syntax for collection-valued parameters in IN() expresseion of JPQL query
> --------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-1923
> URL: https://issues.apache.org/jira/browse/OPENJPA-1923
> Project: OpenJPA
> Issue Type: Bug
> Components: query
> Reporter: Pinaki Poddar
> Assignee: Pinaki Poddar
> Priority: Minor
> Fix For: 2.1.0, 2.2.0
>
>
> IN expression in JPQL query is defined in BNF as:
> in_expression ::= {state_field_path_expression | type_discriminator} [NOT] IN { ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }
> The parentheses are used for comma-separated in_term, but no parentheses around collection_valued_input_parameter. OpenJPA 2.0 adheres to this syntax and hence raises exception for
> String jpql = "select a from Address a where a.zip in (:p)";
> em.createQuery(jpql).setParameter(p, Array.asList(12345, 23456));
> java.lang.IllegalArgumentException:Invalid input parameter "p". A collection valued parameter syntax may incorrectly used in the query string. If the parameter is parenthesized, remove the parentheses and try again.
> However, earlier OpenJPA versions supported parentheses around the parameter.
> This issue will reinstate the behavior such that both queries
> "select a from Address a where a.zip in (:p)";
> "select a from Address a where a.zip in :p";
> will be valid when parameter p is bound to a collection or list value.
> The unlikely case of binding a single value to "select a from Address a where a.zip in (:p)" will be disallowed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira