我有以下命名查询:
@NamedQuery(name = Department.getDepartmentsByIds, query = "SELECT tbl FROM Department tbl where tbl.id in (:departmentsIds)")
我想像这样传递参数:departmentsIds = "1,2,3":
query.setParameter("departmentsIds","1,2,3");
但我得到一个错误:
java.lang.IllegalArgumentException: Parameter value [1,2,3] was not matching type [java.lang.Long]
任何想法为什么?