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

Roger Pack (JIRA) noreply at atlassian.com
Wed Apr 4 15:17:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-4157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46183#comment-46183 ] 

Roger Pack commented on HHH-4157:
---------------------------------

I think this is still a problem isn't it?  Or at least shouldn't "select foo from foo where param1 = ?".setParameter(1, "abc") work?

> Query#setParameter(int position, Object value) wrong implementation
> -------------------------------------------------------------------
>
>                 Key: HHH-4157
>                 URL: https://hibernate.onjira.com/browse/HHH-4157
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: entity-manager
>            Reporter: Fabrice Daugan
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list