Uploaded image for project: 'Hibernate ORM'
  1. HHH-8432

Wrong bindings of named parameters in IN clause

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      There is a bug in naming parameters in org.hibernate.impl.AbstractQueryImpl.expandParameterList(String, String, TypedValue, Map).

      When the number of parameters in HQL is >10, and there is more than one parameter with multiple values (there is IN clause), then there is a chance, that values from second IN clause will override values from first IN clause.

      Example:

      Query is in JPA style

      select c from Cat c 
      where c.furColor IN (?1)
      and ... --parameters from ?2 to ?10
      and c.legsNo IN (?11)
      

      Lets assume that ?1 is a collection of 14 elements, and ?11 is collection of 5 elements.
      According to logic in aforementioned method parameters created from ?1 will be named x10_... to x110_, x111_, x112_, x113_.

      Parameters created from ?11 will be named x110_, x111_, x112_, x113_, x114_ .
      First four will override last four from ?1.

      I think that underscore should be added or moved between 'x' and param index.


      This was found in 3.6.10, but as I check, same code exists in 4.2.2 version.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: