[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-361) Query#setParameter(int position, Object value) wrong implementation

Fabrice Daugan (JIRA) noreply at atlassian.com
Mon May 19 10:58:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30207 ] 

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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list