使用 in 子句参数执行 EntityManager 删除本机查询时出现错误。该参数是 List 类型,我想做类似的事情 -
List<UUID> ids = ...
entityManager.createNativeQuery("DELETE FROM FOO WHERE ID IN (:ids)")
.setParameter("ids", ids)
.executeUpdate();
我得到的例外是 -
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: ERROR: IN could not convert type bytea to uuid
Position: 39
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1377)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1387)
at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
[snip]
请让我知道如何运行上面的删除查询。