Relative Content

Tag Archive for javaspring-boottransactions

Handling errors in springboot transactions

I have a scheduled method that is supposed to run once a week (Method A). Method A makes a call to private Method B which is responsible to deleting certain records from my DB. I have marked Method A as Transactional because I want the deletion rolled back in the case of an issue. My problem is how can I log and gracefully recover from an exception? It is my understanding (and my local tests have shown) that if I add a try/catch inside Method A, the rollback will not occur.