When issuing a JPQL query to the database that uses multiple, similarly named, collection-valued parameters that have names ending in numbers, such as :foo0, :foo1, ..., :foo11, the parameters are internally expanded to foo00_, foo01_, so IN(:foo0) becomes IN($foo00_, foo01_, ...) Unfortunately, this means that the 11th element of :foo1 becomes $foo110_ and the 1st element of :foo11 becomes $foo110_ AS WELL. This causes the generation of erroneous database requests, the loss of rows that should be returned and the return of rows that were not requested. In the SQL query, the SQL variables are assigned incorrect values.
Workaround: Do not use JPQL parameters that end in numbers, terminate with letters (:foo0x, :foo1x, ..., :foo11x).
Hibernate 3.3.1 as provided by JBoss 5.1.0.GA on Ubuntu x86_64 8.10 and Oracle (Sun) Java 1.6.0_20 using PostgreSQL 8.4.4
Cannot reproduce – these are now translated to positional parameters.