I have an JPQL named query declared this way:
@NamedQuery(name = "Client.findByInternalIds", query =
"select o from Client o where o.internalId in (:internalIds)")
Here, :internalIds
is supposed to be a list i pass as a parameter to the named query on runtime. There problem is whenever i try to do this:
@Override
public List<Client> getClientsByInternalIds(List<Integer> internalIds) {
TypedQuery<Client> nq = em.createNamedQuery("Client.findByInternalIds", Client.class);
nq.setParameter("internalIds", internalIds);
return nq.getResultList();
}
I get basically this error (exception)
java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter internalIds with expected type of class java.lang.Integer from query string select o from Client o where o.internalId in (:internalIds)
I searched around the internet for a solution, and all seem to say that my syntax is correct, so can anyone help me figure out this please? Thank you.
FYI, using WebLogic 12c, with EclipseLink.