[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5126?page=c...
]
Gail Badner edited comment on HHH-5126 at 1/18/11 3:02 PM:
-----------------------------------------------------------
This is a proposed fix so that IN expressions will work with a collection-valued
input-parameter that is optionally enclosed in parentheses:
https://github.com/hibernate/hibernate-core/pull/33
For example, both of the following will work if a collection is bound to the parameter:
select item from Item item where item.name in :names select item from Item item where
item.name in (:names)
JPA 2.0 spec shows the paremeter not enclosed in parentheses. I've specifically
allowed the paremeter to be enclosed in parentheses because disallowing it would break the
non-JPA use case.
This fix works as follows:
1) hql.g was updated to allow a parameter that is not enclosed in parentheses
2) AbstractQueryImpl.expandParameterList(...) calls a new overloaded StringUtils.replace()
that takes a boolean parameter, encloseInParensIfNecessary. When true, replacement text is
explicitly enclosed in parentheses, if the placeholder was not immediately enclosed in
parentheses (ignoring whitespace).
3) the special case where AbstractQueryImpl.expandParameterList(...) checks for one value
was also changed to check for parentheses.
Steve, please take a look.
Thanks,
Gail
was (Author: gbadner):
https://github.com/hibernate/hibernate-core/pull/33
JPA Query with InExpression and Collection_valued_input_parameter
Complains About Bad Syntax
--------------------------------------------------------------------------------------------
Key: HHH-5126
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5126
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1, 3.6.0
Reporter: Guido Müller
Assignee: Gail Badner
Priority: Blocker
Fix For: 3.6.1, 4.0.0.Alpha1
Attachments: QueryTest.java.patch
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.
--
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