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
         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

Reply via email to