[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-361?page=co...
]
Fabrice Daugan commented on EJB-361:
------------------------------------
The code used to reproduce this error :
Query queryObject = em.createQuery(queryString);
if (values != null) {
for (int i = 0; i < values.length; i++) {
queryObject.setParameter(i + 1, values[i]);
}
}
return queryObject.getResultList();
Query#setParameter(int position, Object value) wrong implementation
-------------------------------------------------------------------
Key: EJB-361
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-361
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.2.GA
Reporter: Fabrice Daugan
Original Estimate: 2 hours
Remaining Estimate: 2 hours
The Hibernate JPA javax.persistence.Query#setParameter(int position, Object value)
implementation does not suit to the JPA specicafication.
Indeed, the actual integer passed to the operation is converted to String by Hibernate
and then used to find the named parameter.
Please have a look to the folowing stack trace :
java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException:
org.hibernate.QueryParameterException: could not locate named parameter [1]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:185)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:240)
at org.springframework.orm.jpa.JpaTemplate$9.doInJpa(JpaTemplate.java:316)
To repoduce this error :
--
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