Pass a List
to the setParameter
method instead of a String
. The generic type argument of List
should correspond with the type of your departmentIds
field.
List<Integer> ids = new ArrayList<Integer>(); //this should be your id column's type
ids.add(1);
ids.add(2);
ids.add(3);
query.setParameter("departmentsIds",ids);