Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsUse a local transaction manager when one transactional resource is enough. Use JTA with XA-enlisted resources when one transaction must coordinate multiple supported resources, such as a database and a message broker. Spring’s @Transactional annotation defines a transaction boundary through the configured manager; it does not, by itself, make unrelated databases or a database and broker commit or roll back together.
What makes a Spring transaction distributed?
A transaction is distributed when it coordinates more than one transactional resource—for example, a database connection and a messaging session—so their outcomes are managed as one logical transaction. The important question is not how many repositories, APIs, or annotated methods are involved. It is whether the operations use one underlying resource or several independently managed resources, and whether those resources participate in the same transaction coordinator.
Spring provides a consistent transaction abstraction, but the configured PlatformTransactionManager and the resource integrations determine what that abstraction controls. Calling JDBC and JPA code inside one method can still be a local transaction if both use the same DataSource and the Spring JPA integration can expose the transaction’s connection. Two different DataSources, or a database plus an independently managed JMS session, do not become atomic just because both calls occur under @Transactional.
Choose the transaction model that matches the resources
| Situation | Usual fit | What it does—and does not—coordinate |
|---|---|---|
| One JDBC DataSource | Local JDBC transaction, commonly DataSourceTransactionManager |
Controls work on that DataSource; does not enlist unrelated resources. |
| One JPA persistence resource | Local JPA transaction, commonly JpaTransactionManager |
Controls the persistence unit; can also support JDBC access on the same DataSource when the configured JPA dialect can retrieve its connection. |
| Multiple resources that must commit or roll back together | JTA transaction manager plus correctly integrated XA-capable resources | Coordinates participating resources through a transaction coordinator; an annotation without resource enlistment is insufficient. |
| A resource that can tolerate separate completion | A deliberately bounded non-XA design, selected for its failure behavior | May reduce coordination requirements, but can permit partial completion, duplicates, or other outcomes that a global transaction is intended to prevent. |
Spring’s JPA reference recommends local transactions for the standard single-persistence-resource case. The Spring Framework JtaTransactionManager API likewise says a DataSourceTransactionManager is sufficient for a single JDBC DataSource. Do not choose JTA merely because an application has multiple repositories or uses both ORM and JDBC.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
When JTA and XA are appropriate
Choose JTA/XA when a business operation genuinely requires several transactional resources to succeed or fail together, and each resource can participate in the coordinator’s transaction. Spring’s JtaTransactionManager adapts Spring’s transaction abstraction to a JTA provider; it does not itself turn a regular connection pool or messaging factory into an XA participant.
What must be configured
- A coordinator: a Jakarta EE transaction manager or a standalone JTA provider must manage the global transaction.
- XA-capable resources: database pools and messaging connections must support XA and be integrated with the coordinator. For JPA using JTA, the persistence unit must be configured for JTA transaction type, subject to the provider’s requirements.
- Spring integration: the application must use the transaction manager and resource beans wired for participation. In a Jakarta EE environment, Spring Boot can locate a container manager through common JNDI locations; server-managed resources are generally the appropriate companion.
- Recovery and operations: the coordinator and resources must be configured and operated as a coordinated system, including whatever recovery procedures the chosen provider requires.
Spring Boot 4.1.1 documents JTA integration for XA-aware JMS, DataSource, and JPA resources. For embedded coordinator integrations, it describes the XAConnectionFactoryWrapper and XADataSourceWrapper extension points. These are integration mechanisms, not proof that arbitrary libraries or pools participate. Check the exact Spring Boot, Framework, JPA provider, connection pool, broker, coordinator, and server versions in the deployment.
JTA behavior that affects application code
The plain Spring JTA adapter delegates to the provider. Standard JTA supports transaction timeouts, but the Spring Framework 7.0.9 API notes that this adapter does not provide per-transaction isolation-level control through standard JTA. Suspending a transaction for propagation modes such as REQUIRES_NEW or NOT_SUPPORTED depends on a JTA TransactionManager being available; server-specific extensions may differ.
Rank #2
JTA does not make a transaction span a remote HTTP or RPC call. Spring’s declarative transaction documentation says transaction context does not propagate across remote calls. Treat operations across service boundaries as a distributed workflow, rather than assuming that one local Spring transaction covers them.
What happens when you do not use XA?
Non-XA approaches are not interchangeable with a global transaction. They can be sensible when the resource topology or business requirements make XA unnecessary, but the design must account for the exact failure point at which one operation can complete while another does not. David Syer’s January 2009 article, “Distributed transactions in Spring, with and without XA,” provides a useful historical taxonomy of such patterns; its configuration examples are not modern setup guidance.
Full XA with two-phase commit
The coordinator asks participating resources to prepare and then directs the commit, retaining coordination information that supports recovery after failures. This is the broadest coordination option in Syer’s taxonomy, with extra coordination and I/O compared with simpler local work. Actual latency and throughput depend on the deployment; the cited Spring documentation and Syer article provide no current comparable benchmark.
Rank #3
One-phase optimization
A transaction manager may use a one-phase optimization when only one resource participates, avoiding the full two-phase protocol in that case. It does not make a transaction across several resources equivalent to a one-resource transaction.
Last-resource gambit
This approach combines XA resources with one non-XA participant and relies on commit ordering. Syer cautions that it is less safe than a fully XA-coordinated transaction and that failures can be difficult to diagnose. Do not treat it as a general substitute for making all required participants XA-capable.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Share one underlying transaction resource
Sometimes apparently different operations can be made to use the same underlying resource. For example, JPA and JDBC can share a database transaction when they use the same DataSource and the Spring integration supports access to that connection. A messaging store that shares the business database may be another possibility where the platform supports it. This can avoid coordinating independent resources, but it is constrained by the actual platform and application design.
Best-efforts one-phase commit
A design can commit local transactions in an order chosen around business semantics. If business processing fails before commits begin, the application may roll back both local transactions. But if the first resource commits and a later commit fails, the system is left partially complete. In a database-and-JMS flow, that can mean a committed database change with no corresponding message, or a message that is delivered again after recovery. Idempotent processing and duplicate detection can manage some of those outcomes; they do not turn the design into XA-level atomic coordination.
Keep a resource outside the main transaction
Some work may properly be independent of the main business transaction—for example, certain audit or read-mostly operations—if the business meaning permits it. Define what happens when the main operation fails and the separate work has already completed. Whether this is acceptable is a business decision, not a transaction-manager setting.
Avoid assuming unrelated resources participate
The unsafe case is to expect a local transaction to roll back work performed by an independently managed resource without explicit integration. The happy path can make such code appear correct; an exception may reveal that one resource was never enlisted. Verify participation and failure behavior rather than inferring them from the presence of @Transactional.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Understand where Spring’s transaction context applies
Spring declarative transactions use transaction metadata with an AOP proxy. In imperative code, the transaction manager is a PlatformTransactionManager, and the transaction context is bound to the current thread. Work started on a newly created thread does not inherit that context. Reactive transactions use a ReactiveTransactionManager and Reactor context; participating operations must remain in the relevant reactive pipeline and context.
These boundaries matter even with the right manager: a method call that bypasses the proxy, work moved to another thread, reactive work that leaves its context, and a remote service call can each fall outside the transaction you expected. Check the transaction model and execution path together.
Make the choice using failure requirements, not annotation count
- Count transactional resources: distinguish multiple data-access APIs from genuinely separate resource managers.
- Confirm participation: establish that every resource required for atomicity is XA-capable and integrated if choosing JTA/XA.
- Define crash outcomes: decide whether partial completion, redelivery, or duplicate processing is acceptable and how it will be detected or handled.
- Account for operations: include coordinator configuration, resource setup, and recovery administration in the cost of XA.
- Measure the real deployment: compare latency and throughput under representative workload and failure conditions. The available sources make qualitative trade-off claims, not a current apples-to-apples performance comparison.
Spring’s stable 7.0.9 transaction API, Spring Boot 4.1.1 JTA documentation, and the Spring JPA 6.2 reference describe the integration points cited here. Verify details against the precise versions and providers in your own system; these docs do not establish that every pool, broker, or application server supports the same setup.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

