In the following JPA query, the :fcIds named parameter needs to be a list of integer values:
@NamedQuery(name = "SortTypeNWD.findByFcIds", query = "SELECT s FROM SortTypeNWD s WHERE s.sortTypeNWDPK.fcId IN (:fcIds)")
Quite logically, this is what is done when the named query is called:
Query findByDatesPlFcIds = em.createNamedQuery("SortTypeNWD.findByFcIds");
findByDatesPlFcIds.setParameter("fcIds", fcIds);
Where the variable fcIds is an ArrayList containing integers.
All the above code works fine with Hibernate but doesn't with TopLink:
Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter fcIds with expected type of int from query string SELECT s FROM SortTypeNWD s WHERE s.sortTypeNWDPK.fcId IN (:fcIds).
Is there a workaround to use a List as a named parameter in TopLink? Can the type of the named parameter be forced?