openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-1992) java.lang.ArrayIndexOutOfBoundsException if positional parameter are not started from 1
Date Fri, 06 May 2011 22:24:03 GMT


Pinaki Poddar commented on OPENJPA-1992:

The binding parameter indexing, ordering and naming are somewhat sensitive to many implicit
assumptions throughout our codebase. It is made more sensitive after we introduced Prepared
Query Caches that rebinds parameters (that originally could have been named) to SQL (that
only accepts integral parameter). The index of parameters affects the kernel and also note
that kernel internals can insert its own parameters that are invisible to the user application.

Please be careful with a change unless it is broken for regular, spec-compliant use case.
If for example we allow numeric parameters *not* to begin with 1 and be monotonic and continuous,
nothing stops a user to specific "SELECT a FROM A a where and A.something=?34562"
-- it will get real hairy to support such an innovative user :) 

An informative error message when integral parameters violate *any* of the following
  a) start with 1
  b) monotonic
  c) continuous
is all that is required to keep life simple, code uncomplicated and majority of user satisfied.

> java.lang.ArrayIndexOutOfBoundsException if positional parameter are not started from
> ---------------------------------------------------------------------------------------
>                 Key: OPENJPA-1992
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.1.0
>            Reporter: Han Hong Fang
>            Assignee: Michael Dick
>         Attachments:, OPENJPA-1992.patch
> Query q = em.createQuery("SELECT x FROM Magazine x WHERE x.title = ?2 and x.price >
> q.setParameter(2, "JDJ").setParameter(3, 25.0);
> When the query is executed, java.lang.ArrayIndexOutOfBoundsException will be thrown.
Since "JDJ" and "25.0" will be stored in arr[0] and arr[1] (when arr.size =2) but the query
execution code tries to get them via arr[2] and arr[3].

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message