Issue Type: Bug Bug
Affects Versions: 4.2.2, 4.2.0.Final
Assignee: Unassigned
Components: entity-manager
Created: 03/Jul/13 5:54 AM
Description:

The following method:
public <T> TypedQuery<X> setParameter(Parameter<T> param, T value)
in class org.hibernate.ejb.QueryImpl has a wrong parameter existence check in line 317:

if ( ! parameters.contains( param ) )

{ throw new IllegalArgumentException( "Specified parameter was not found in query" ); }

If you use a custom javax.persistence.Parameter implementation then this will never recognize your parameters since it cannot be equal to an existing parameter which is created at query creation time and is always an instance of org.hibernate.ejb.QueryImpl.ParameterImpl.

Instead of using Set.contains() and therefore implicitly using QueryImpl.ParameterImpl.equals() this check could be implemented by comparing parameter names or positions.

Project: Hibernate ORM
Priority: Major Major
Reporter: Patrik Varga
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira