我有一个像这样的变量long[] ids = [10, 11]
,我正在尝试像这样触发查询:
Query query2 = session.createQuery("update Employee e SET e.isLatest = false where e.id not in (:ids)");
query2.setParameter("ids", ids);
query2.executeUpdate();
但我收到了类似的错误
org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint <> character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
如何在NOT IN
参数中传递数组变量?或者有没有其他方法来处理这样的查询?