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

Executing this query is giving the following error:

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

How can I pass list parameter in Query?

xyz
  • 2,160
  • 3
  • 20
  • 31
  • @SashaSalauyou Its not duplicate!I am passing list as a parameter. – xyz Apr 23 '15 at 17:30
  • Edit the question to explain the difference. – Alex Salauyou Apr 23 '15 at 17:32
  • @SashaSalauyou Clearly its not that we cannot row by `in(...)` and not duplicate too as suggested by you.So its a request plz read the question and check how exactly its is same as the one you are marking as duplicate. – xyz Apr 23 '15 at 18:20

1 Answers1

2

Try the annotation @Modifying on the delete method. Also take a llok at this updating boolean value in spring data jpa using @Query, with hibernate

Community
  • 1
  • 1
Anarki
  • 373
  • 5
  • 20