Transactional annotation
Spring’s @Transactional annotation declares that a method or class should participate in managed transaction execution.
Spring Start Here, Second Edition
The Spring @Transactional annotation declares that a method or class should execute within a managed transaction.
- How it is used
- Uses the annotation to keep multi-step Spring service operations consistent.
- How deep it goes
- Explains method and class placement, aspect interception, and default rollback behavior, including handled and checked exceptions.
- Examples
- Demonstrates an account transfer, a successful balance change, and a deliberately thrown runtime exception.
- What you can do after
- Apply it via Spring to a service method and recognize when default rollback will occur.
Read how Spring Start Here, Second Edition explains Transactional annotation →
Quarkus in Action
@Transactional is an annotation that defines a transaction boundary for an operation executed within a conventional transaction context.
- How it is used
- Marks CDI methods that persist or modify database entities so their changes can be committed.
- How deep it goes
- Explains default boundary behavior, six transaction types, class-level use, and a programmatic alternative without detailing transaction-manager internals.
- Examples
- Uses a reservation POST that persists an entity, GraphQL mutations that persist or delete cars, and a gRPC lambda requiring a new transaction.
- What you can do after
- Apply it via Jakarta Transactions in Quarkus to bound CDI write methods and select transaction behavior for incoming calls.
Read how Quarkus in Action explains Transactional annotation →
Java Persistence with Spring Data and Hibernate epub
The Spring Transactional annotation declares that method or class execution participates in transaction management.
- How it is used
- Declares transaction boundaries and execution behavior for Spring persistence operations and transactional tests.
- How deep it goes
- Explains placement, inheritance, rollback rules, transaction properties, configuration, and test lifecycle without descending into transaction-manager internals.
- Examples
- Uses ItemDaoImpl and BidDaoImpl classes, DatabaseService initialization, and Spring transactional tests with UserService.
- What you can do after
- Operate/configure Spring persistence components and tests with explicit rollback, propagation, isolation, timeout, and read-only policies.
Read how Java Persistence with Spring Data and Hibernate epub explains Transactional annotation →
Clean Applications with Hexagonal Architecture
Spring's @Transactional annotation declares transactional behavior for a class or method.
- How it is used
- Declares transactional intent at the handler boundary while keeping framework concerns out of the application core.
- How deep it goes
- Explains handler placement, read-only queries, and the runtime bridge that interprets Either failures for rollback.
- Examples
- Uses article publication as a command example and a read-only article query handler as a query example.
- What you can do after
- Apply it by marking handlers as atomic units and declaring query transactions read-only.
Read how Clean Applications with Hexagonal Architecture explains Transactional annotation →
Also covered in
- Testing Spring Boot ApplicationsIn early access (MEAP)
What to know first
- exceptionAn exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can be handled or propagated.
Related concepts
- database transactionconfigures · A database transaction is a bounded unit of database operations whose changes are treated as one logical whole, typically committed or rolled back together.
- command handlerconfigures · A command handler is a software component that receives and processes commands representing requested application actions or state changes.
- interceptorconfigures · An interceptor is a software component that intercepts operations, requests, or messages to inspect or modify them or apply behavior around their processing.
Questions about Transactional annotation
What is Transactional annotation?
Spring’s @Transactional annotation declares that a method or class should participate in managed transaction execution.
Which Manning books explain Transactional annotation?
Spring Start Here, Second Edition, Quarkus in Action, Java Persistence with Spring Data and Hibernate epub and Clean Applications with Hexagonal Architecture.
What should I know before learning Transactional annotation?
Manning books that teach Transactional annotation usually introduce exception first.
What are the parts of Transactional annotation?
Transactional annotation includes noRollbackFor.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



