删除行是数据库

Deleting row is database

@Query("delete from MyClazz a where c.id in (?1)")
void deleteData(List<Long> ids);

执行此查询出现以下错误:

Caused by: java.lang.IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [delete from MyClazz a where a.id in (:x10_)]
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:306)
at org.springframework.data.jpa.repository.query.JpaQueryExecution

如何在查询中传递列表参数?

在删除方法上尝试注释 @Modifying。 也看看这个 updating boolean value in spring data jpa using @Query, with hibernate