@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
如何在Query中传递list参数?
答案 0 :(得分:2)
在delete方法上尝试注释@Modifying
。
还可以参加此updating boolean value in spring data jpa using @Query, with hibernate