alialdev / projects

Projects
0 stars 1 forks source link

@Transactional #6

Closed ali-al-fntext closed 1 week ago

ali-al-fntext commented 1 month ago

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.

dvt32 commented 3 weeks ago

You can close this issue.