Issue
I'm having problems executing an update query in springdatajpa. here is the code in the repository layer:
@Transactional
@Modifying
@Query("update CustomerTransaction ct set ct.amountPayment =:trnAmount WHERE ct.loanAccount.id=:loanAccountId AND ct.paymentTerm=:paymentTerm")
List<CustomerTransaction> updateCurrentCustomerTransaction(@Param("loanAccountId") long loanAccountId,
@Param("paymentTerm") int paymentTerm,
@Param("trnAmount") BigDecimal trnAmount);
As you can see, I've already added the @Modifying annotation but it still throws an error of "Not supported for DML operations" I am using Hibernate 5.4. Any help would be highly appreciated.
Solution
You need to set the return type of your method to void
or int
.
Answered By - PeterD