JPA 2.0 spec final chapter 4.6.9 In Expressions
In the spec there are 3 alternatives allowed for the query argument. For the 3rd alternative there are no parenthesis allowed.
Hibernate seems to expect these illegal parenthesis.
The error occurs within a named query in an entity class.
Well as I asked on the other issue, please attach a test case that reproduces this. The tests I wrote show this working perfectly fine. Even in the case of double parameter lists.
Sorry for being kind of offline so long. I think the difference is that I was using lists of entities for the IN parameters :companies and :docTypes. IIRC only primitive types are allowed - at least by the JPA? Since I'm not 100% sure, can anybody confirm this? (Note I duplicated this comment onto HHH-7407, too.)
I'm experiencing this issue in Hibernate 4.2.1 Final
In out case we've got a IN placeholder as the last part of a sub query.
SELECT column_one, (select count from XYZ where column IN arameterList) FROM ABC
The code in org.hibernate.internal.util.StringHelper.replace(String, String, String, String, boolean, boolean) on line 168 checks to see if the placeholder has both an opening backet in front of AND a closing backet after. If both of these criteria are not satisfied no backets are inserted.
A similar check to this is done in org.hibernate.internal.AbstractQueryImpl.expandParameterList(String, String, TypedValue, Map) on line 790
Hibernate doesn't realise the closing bracket after the placeholder belongs to the sub query.
Chris, can you check to see if this is still a problem in 4.3? If so, please open a new Jira issue.
I just encountered this error using Hibernate 4.3.10.Final - after adding parens around the ":myVar" the error went away. I also tried adding a space between :myVar and the close paren but no difference.