Variable naming when expanding collection-values JPQL parameters causes name collisions
---------------------------------------------------------------------------------------
Key: HHH-5460
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5460
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: 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
Reporter: Simon Dierl
Priority: Minor
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).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira