tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Han Hong Fang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENEJB-1539) IllegalArgumentException when input parameters for select is more than input parameters in EJB QL query
Date Wed, 04 May 2011 03:32:03 GMT

    [ https://issues.apache.org/jira/browse/OPENEJB-1539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028573#comment-13028573
] 

Han Hong Fang commented on OPENEJB-1539:
----------------------------------------

More info:

According to JavaEE sdk API, in class javax.persistence.Query, method setParameter(int position,
java.lang.Object value) throws java.lang.IllegalArgumentException - if position does not correspond
to a positional parameter of the query or if the argument is of incorrect type


> IllegalArgumentException when input parameters for select is more than input parameters
in EJB QL query
> -------------------------------------------------------------------------------------------------------
>
>                 Key: OPENEJB-1539
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1539
>             Project: OpenEJB
>          Issue Type: Bug
>          Components: container system
>    Affects Versions: 4.0
>            Reporter: Han Hong Fang
>             Fix For: 4.0
>
>         Attachments: openejb-1539.patch
>
>
> Following example shows the scenario that input parameters of select (which is three)
is more than input paramters in EJB QL query (which is two).
>       <query>
>         <description></description>
>         <query-method>
>           <method-name>findBooks</method-name>
>           <method-params>
>             <method-param>java.lang.String</method-param>
>             <method-param>java.lang.String</method-param>
>             <method-param>java.lang.String</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT object(c) from BookBean c WHERE c.title = ?2 AND c.author
= ?3</ejb-ql>
>       </query>
> This is a valid scenario according to ejb3.1 spec section 9.2.6.4. 
> Currently,  
> Class JpaCmpEngine  ... {
> private List<Object> executeSelectQuery(Query query, Object[] args) {
> ...
> query.setParameter(i + 1, arg)    // this will throw  java.lang.IllegalArgumentException
when i+1 = 1 since ?1 does exist in EJB QL
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message