Hi,

When positional parameters are used with IN (select ...) query as in the below test case, OpenJpa throws an error that "JPQL positional parameters must start at 1". The same query with named parameters works.

openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestQueryParameterBinding.java

    public void testPositionalParametersWithUpdateQuery() {
        String JPQL_POSITIONAL = "UPDATE Binder p SET p.p3=?1 WHERE p.p1 IN "
  + " (SELECT x.p1 FROM Binder x WHERE x.p1=?2) AND p.p2=?3";
        Query q = em.createQuery(JPQL_POSITIONAL);
        q.setParameter(1,  DBL_VALUE);
        q.setParameter(2,  INT_VALUE);
        q.setParameter(3,  STR_VALUE);

em.getTransaction().begin();
        int result = q.executeUpdate();
em.getTransaction().commit();
        assertEquals(1, result);
    }

<openjpa-2.2.0-SNAPSHOT-r422266:1195104M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Query "UPDATE Binder p SET p.p3 = ?1 WHERE p.p1 in (SELECT x.p1 FROM Binder x WHERE x.p1=?2) AND p.p2=?3" did not contain positional parameter 1. JPQL positional parameters must start at 1. Detected parameters "[2]".

In our application I was able to workaround this error, by adding ?1 = ?1 to the where clause! So it's is not a critical issue, but would be useful improvement. Should I create a Jira Issue for this? 

Regards,
Prashant