gpt4 book ai didi

java - 删除行是数据库

转载 作者:行者123 更新时间:2023-12-02 04:44:07 25 4
gpt4 key购买 nike

@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

关于java - 删除行是数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29830447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com