0

I am using Spring 3.0 in my application, for rollback the database transaction I am using @transactional annotation. In addition to this I am committing the transaction by calling transaction.commit() method. If I receive any exception, the @transactional annotation rollbacks it perfectly even if I called the works transaction.commit() manually. Can someone please clarify this what is happening in back-end.

Vishwa Dany
  • 327
  • 2
  • 16
  • Possible duplicate : http://stackoverflow.com/questions/1099025/spring-transactional-what-happens-in-background – Mehraj Malik May 16 '17 at 12:59
  • No Mehraj. My question is slightly different: is the @transactional annotation rollbacks the committed transaction – Vishwa Dany May 16 '17 at 13:10
  • Possible you're committing a different transaction? Your question sounds like you may have a design issue. Having a clear transactional boundary is very important. If you're manually committing a transaction and using spring's AOP transaction management, that means it's not a clear boundary which can lead to consistency problems. I'd really encourage you to re visit the design. – Taylor May 16 '17 at 13:38
  • Thank you Taylor. – Vishwa Dany May 16 '17 at 14:00

0 Answers0