Paulo Henrique Leal created XMLBEANS-494:
--------------------------------------------

             Summary: ArrayIndexOutOfBoundsException on query
                 Key: XMLBEANS-494
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-494
             Project: XMLBeans
          Issue Type: Bug
    Affects Versions: Version 2.2
         Environment: Websphere 8.0.0.3
            Reporter: Paulo Henrique Leal


Running a query I get a message: openjpa.Runtime: Warn: Supplied user 
parameters "[1, 2, 3, 4, 5]" do not match expected parameters "[1, 1, 2, 3, 4, 
5]" for the prepared query 

the query is like
SELECT 
    test 
FROM 
    com.phleal.persistence.model.Test test 
WHERE 
    EXISTS (
SELECT attr
FROM com.phleal.persistence.model.TestAttribute attr
WHERE attr.test = test AND attr.namespace.namespaceURI = ?1 AND attr.name = ?2 
AND ( ( attr.valueTypeId = ?3 AND attr.stringValue = ?4 ) )
     )
     AND ?5 MEMBER OF reg.testTypes
     AND reg.testCompleted = false

 After this Warning I get an ArrayIndexOutOfBoundsException:


Failed to execute query SELECT 
    test 
FROM 
    com.phleal.persistence.model.Test test 
WHERE 
    EXISTS (
SELECT attr
FROM com.phleal.persistence.model.TestAttribute attr
WHERE attr.test = test AND attr.namespace.namespaceURI = ?1 AND attr.name = ?2 
AND ( ( attr.valueTypeId = ?3 AND attr.stringValue = ?4 ) )
     )
     AND ?5 MEMBER OF reg.testTypes
     AND reg.testCompleted = false". Check the query syntax for correctness. 
See nested exception for details..
                                 <openjpa-2.2.1-SNAPSHOT-r422266:1325904 
nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Failed 
to execute query "SELECT 
    test 
FROM 
    com.phleal.persistence.model.Test test 
WHERE 
    EXISTS (
SELECT attr
FROM com.phleal.persistence.model.TestAttribute attr
WHERE attr.test = test AND attr.namespace.namespaceURI = ?1 AND attr.name = ?2 
AND ( ( attr.valueTypeId = ?3 AND attr.stringValue = ?4 ) )
     )
     AND ?5 MEMBER OF reg.testTypes
     AND reg.testCompleted = false". Check the query syntax for correctness. 
See nested exception for details.
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
        at 
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
        at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
        at 
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
        at 
com.phleal.persistence.TestManager.getRelatedTest(TestManager.java:1794)
.
.
.

        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at 
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 5
        at 
org.apache.openjpa.jdbc.kernel.PreparedSQLStoreQuery$PreparedSQLExecutor.toParameterArray(PreparedSQLStoreQuery.java:161)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:857)
        ... 89 more


I am sure I only pass 5 attributes to the query, I don't know what could 
generate the "[1, 1, 2, 3, 4, 5]" from the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to