JPA Named Parameters, with collections
843830Feb 21 2007 — edited Feb 22 2007Hi
Is it possible with JPA to pass in a collection as named parameter into a query.
ArrayList() list = new ArrayList();
list.add("1");
lsit.add("2");
i.e. em.createNamedQuery("named").setParameter("collection",list).getResultList();
where the named query is something like
SELECT i FROM Person i WHERE i.address IN (:collection)
This throws an error: IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter collection with expected type of class java.lang.String from query
If it is possible what am i doing wrong??
Thanks
Message was edited by:
glen_