This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Each database is declared in its own separate XA-capable DataSource, and you must use a JTA transaction manager to synchronize updates.

Find a way to gather all databases into a single java DataSource (eg. Oracle DB link or such), and use a simple transaction manager (no need to be jta).

It is not possible to use raw JDBC with multiple datasources synchronized by a single transaction, unless you want to devlelop 2-phases commit by hand. If you opt for the first solution, then you should better use an ORM : JPA is the standard, and can join a JTA transaction.
In this situation, you have to declare the following beans:

DataSource, typically a JNDI lookup

EntityManagerFactory, using the EMF factory bean provided by Spring; inject the DataSource into the EMF

TransactionManager, of type JtaTransactionManager or the implementation-specific subclass according to your application server

If you can gather all databases into a single DataSource, the solution is simpler: you can use raw jdbc, but instead of doing the plumbing code by hand (get connection, create statement, execute it, close everything, handle exceptions, etc.), consider using Spring's JdbcTemplate.
You must declare a transaction manager of type DataSourceTransactionManager, into which you inject the DataSource. The DAO are configured with that same DataSource. The DataSource does not need to be XA-capable. Spring will do the rest.

Have a look at appropriate chapters in the Spring documentation related to the above-mentioned topics to get more information.

Comment

This is the reason why transactions exist : group multiple operations into a single unit of work, and either commit all or rollback all.

When wrapping the operations into a (local) transaction, Spring stores the Hibernate session, or JDBC connection, or JPA EntityManager when the transaction starts and always reuses that same source for all queries issued inside the transaction. This (in addition with Hibernate or JPA support) ensures all database operations occurs in the same unit of work.

Simply put, you have to declare a bean which type implements PlateformTransactionManager (there's one for raw JDBC: DataSourceTransactionManager, one for Hibernate: HibernateTransactionManager etc). You have to inject the source into the transaction manager (SessionFactory for Hibernate, DataSource for raw jdbc) and this is all for the configuration.

In order to use it, you can use declarative or programmatic demarcation. Read the manual for further info.