Issues

Select view

Select search mode

 
50 of

Failure with JPQL positional queries with collection parameter (IN statement for example)

Fixed

Description

Hibernate 5.3.0.Beta2 fail to handle JPQL positional queries if there is one "scalar" parameter and one "collection" with more than one element.

For example:

throws:

This query used to work with Hibernate 5.2.x (including 5.2.13).

This query is also broken (with parentheses around ?1), but only if there is more than one element in the collection parameter:

I'm working on a test-case based on the hibernate codebase. Github branch incoming.

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created February 13, 2018 at 1:59 PM
Updated April 27, 2018 at 1:36 PM
Resolved March 14, 2018 at 4:19 PM

Activity

Former userFebruary 16, 2018 at 1:17 PM

After an extended query is created for an initial query with a parameter as a list with multiple values, we can see that it contains now both named (:x1_0, :x1_1) and positional (?2) parameters, which is not allowed by org.hibernate.hql.internal.ast.HqlSqlWalker#generatePositionalParameter, which checks for existence of named parameters before setting positional ones

Laurent AlmerasFebruary 13, 2018 at 2:10 PM

Here is a github branch with three new test-cases that hilight the behavior described in this issue:

https://github.com/hibernate/hibernate-orm/compare/master...lalmeras:HHH-12290?expand=1

  • positional and collection without parentheses: error

  • positional and one-item collection within parentheses: OK

  • positional and collection with parentheses: error

Flag notifications