Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] jpql named parameter list as input does not work

We use JPA 1.0/EclipseLink 1.2 RC1 and it does not work.


James Sutherland wrote:
> 
> This 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?
> 
> 
> 
> Thomas Rost wrote:
>> 
>> We 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
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jpql-named-parameter-list-as-input-does-not-work-tp25678654p25782039.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top