Spring Data JPA update query (Not supported for DML operations)

I'm having problems executing an update query in springdatajpa. here is the code in the repository layer:

@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.

Read more here: https://stackoverflow.com/questions/68463162/spring-data-jpa-update-query-not-supported-for-dml-operations

Content Attribution

This content was originally published by Jerome Abril at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: