Junior — Middle
What are the main reasons that can lead to transaction rollback in Spring Framework?
sobes.tech AI
Answer from AI
Main reasons for rollback of a transaction in Spring Framework:
- RuntimeExceptions or Errors by default lead to rollback.
- Explicit rollback calls via TransactionStatus.
- Conflicts with database locks or errors during data saving.
- Violation of data integrity constraints (e.g., uniqueness).
It is important to remember that checked exceptions by default do not cause rollback unless configured otherwise through the @Transactional annotation attributes.