Can I give List<Long>
as the IN
parameter when using openJPA?
The database I am using is MySQL latest version. The example query which I am trying to work is as below and also pasted the error which I am getting. Please let me know what I need to do to get this working.
Select * from table t where c in (?)
.createNativeQuery(TOPIC)
.setParameter(1, listNo)
Where listNo
is List<Long>
.
19:46:47,376 ERROR [org.jboss.ejb3.invocation] (http--127.0.0.1-8080-6) JBAS014134: EJB Invocation failed on component TopicService for method public abstract com.zreflect.emyed.vo.circle.TopicVO[] com.zreflect.emyed.ejb.interfaces.ITopicService.getSelectedTopics(long,java.util.List,com.zreflect.emyed.vo.UserSession): javax.ejb.EJBException: <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The specified parameter of type "class java.util.ArrayList" is not a valid query parameter.
I have converted the array to string seperated by comma and passed the parameter value.
It is working this way now as array are not supported for native query.