I have tried various suggestions on solving the above error but its still there. Below is my repository. How can I solve this?
@Transaction
public interface ApplicationRepository extends JpaRepository<Application, BigInteger> {
@Modifying
@Query(nativeQuery = true, value = "update application set transaction_status = :transaction_status where id =:id")
void updateStatus(@Param("transaction_status") int transaction_status, @Param("id") BigInteger id);
}
Given your ApplicationRepository
, I am assuming that you are using Spring JPA.
The exception you are facing to is javax.persistence.TransactionRequiredException
.
You have already added @Transactional
annotation to the repository, but please make sure that the import which you are using for is org.springframework.transaction.annotation.Transactional
, because it seems that you might be using javax.transaction.Transactional
.
I also suggest to you to use @Transactional
on the class/method of the repository consumer.