CriteriaQuery - IllegalArgumentException when parameter name clashes with generated parameter name

Description

See test case: https://github.com/AlasdairMacleanGlobal/hibernate-orm/commit/6db733552a08c034b671c048545ab1071eb9a3a0

EntityManager.createQuery() throws: java.lang.IllegalArgumentException: Parameter value [] did not match expected type [java.lang.String

This seems to occur only when:

  • a named parameter is used, named "param0" (originally found in a Spring Data JPA-generated query, which generates parameter names "param"+<position>)

    • Changing the test code to cb.parameter(String.class, "paramA") for example doesn’t error

  • An escape character is specified

Activity

Show:

Nathan Xu May 2, 2022 at 4:19 PM

I think “param0” is perfectly valid name. The issue doesn’t show up in v6 though.

Alasdair Maclean April 6, 2022 at 5:30 PM

Realising it’s possible “param0” is an invalid name for a parameter - apologies if that’s the case!

Details

Assignee

Reporter

Worked in

Components

Affects versions

Priority

Created April 6, 2022 at 4:01 PM
Updated May 2, 2022 at 4:19 PM