|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
jpql named parameter list as input does not workWe try to pass named parameter as a list in a jpql query. But we get the following error:
{SELECT returnValue FROM Need returnValue WHERE returnValue.type = '001' and ( returnValue.type = :type or returnValue.BUID IN (:BUID) ) } {SELECT returnValue FROM Need returnValue WHERE returnValue.type = '001' and ( returnValue.type = :type or returnValue.BUID IN (:BUID) ) } INFO Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter BUID with expected type of class java.lang.String from query string SELECT returnValue FROM Need returnValue WHERE returnValue.type = '001' and ( returnValue.type = :type or returnValue.BUID IN (:BUID) ) . INFO at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameterInternal(EJBQueryImpl.java:975) INFO at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:862) ... Info: it works with hibernate and we have a workaround by transforming list content into a comma separated string. Question: Bug or wrong usage of named parameter? Kind regards, Tom |
|
|
Re: jpql named parameter list as input does not workThis was not supported in JPA 1.0/EclipseLink 1.1, but is supported in JPA 2.0/EclipseLink 2.0/1.2.
What version are you using?
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
|
|
Re: jpql named parameter list as input does not workWe use JPA 1.0/EclipseLink 1.2 RC3 and it does not work.
We found out it works without the brackets in the query: X IN :BUID instaed of X IN (:BUID). Question: It's a feature or a bug? In Hibernate brackets are mandatory.
|
|
|
Re: jpql named parameter list as input does not workIt definitely should not have brackets, brackets would mean you are binding a value inside the list, not the entire list. This is the JPA 2.0 grammar.
|
| Free embeddable forum powered by Nabble | Forum Help |