3
JpaRepository不支持DML操作[删除查询]
我已经编写了一个查询来删除我的扩展接口中的某些对象JPaRepository,但是当我执行查询时会抛出异常!谁能为我解释一下? 查询: public interface LimitRepository extends JpaRepository<CLimit, Long> { @Query("delete from CLimit l where l.trader.id =:#{#trader.id}") void deleteLimitsByTrader(@Param("trader") CTrader trader); } 我收到此错误,请问,请为我解释一下,谢谢大家:) 例外: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [delete from com.query.domain.CLimit l where l.trader.id =:__$synthetic$__1] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.errorIfDML(QueryTranslatorImpl.java:318) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:369) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:495) …