A practical guide to database transaction management in Spring Boot, covering three approaches: plain JDBC, declarative @Transactional annotation, and programmatic TransactionTemplate. Explains @Transactional defaults (REQUIRED propagation, RuntimeException rollback), how to customize propagation levels and rollback rules, and a critical gotcha: calling a @Transactional method from within the same class bypasses the Spring AOP proxy, causing the inner method's transaction settings to be ignored. The fix is to move the method to a separate class.
Table of contents
Transaction Handling using JDBCSpring’s declarative transaction handling using @Transactional annotationSpring’s programmatic transaction handling using TransactionTemplateA common mistake while using @Transactional annotationSummarySort: