When managing transactions through JDBC, should I manually rollback if some exception occurs or leave it to the database to do the rollback on its own?

The database in question is Postgresql. As far as I have understood, if a transaction fails, then it would rollback on its own but whatever jdbc code I have seen online shows manually doing the rollback. What will happen if the database has already rolled back and then I roll it back again manually?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.