So for deleteByImdbId method, I have added a deleteByImdbId method to the MovieRepository and TVShowRepository classes.
deleteBy methods are supported by Spring JPA and normally they are transactional by default.
But when I invoked the delete method
public void delete(String imdbId) {
tvShowRepository.deleteByImdbId(imdbId);
}
I get error below
jakarta.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call
It indicates that there is no active transaction available for this operation.
To resolve this, I will ensure that the deleteByImdbId operation is transactional by applying the @Transactional annotation to its method.
So for deleteByImdbId method, I have added a deleteByImdbId method to the MovieRepository and TVShowRepository classes.
deleteBy methods are supported by Spring JPA and normally they are transactional by default.
But when I invoked the delete method public void delete(String imdbId) { tvShowRepository.deleteByImdbId(imdbId); } I get error below jakarta.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call
It indicates that there is no active transaction available for this operation.
To resolve this, I will ensure that the deleteByImdbId operation is transactional by applying the @Transactional annotation to its method.