JpaRepository Not supported for DML operations [delete query]

Try this:

public interface LimitRepository extends JpaRepository<CLimit, Long> {
  @Modifying
  @Query("delete from CLimit l where l.trader.id =:#{#trader.id}")
  void deleteLimitsByTrader(@Param("trader") CTrader trader);
}

Whenever you are trying to modify a record in db, you have to mark it as @Modifying, which instruct Spring that it can modify existing records.

The modifying queries can only use void or int/Integer as return type, otherwise it will throw an exception.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)