Interview questions
Question 110 of 254
FreeWhat is the default rollback behavior of @Transactional, and how do you customize it?
Transactions
By default, @Transactional rolls back only on unchecked exceptions (RuntimeException and its subclasses, and Error) — a checked exception thrown from the method still results in a commit unless configured otherwise. Use `rollbackFor = SomeCheckedException.class` to force rollback on a specific checked exception, or `noRollbackFor` to suppress rollback for a specific exception type that would otherwise trigger it.
Advanced7 min
