intermediateTransactions — @Transactional, Propagation & Isolation
Does a checked exception automatically roll back a @Transactional method by default?
No — Spring's default rollback rule only triggers automatically for unchecked exceptions (RuntimeException and subclasses). A checked exception requires explicitly configuring rollbackFor = SomeException.class, or the transaction will commit despite the exception being thrown.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response