Hi,
I suppose that you'd like using declarative transactions (via AOP) with Spring. You may need then to read about the Spring transaction management here:
http://www.springframework.org/docs/reference/transaction.html In a nutshell you need to define your transaction manager to be JTA compatible. If you�re using WAS it might look something like this:
For most of the app servers using only the
JtaTransactionManager should be quite enough.
Now assuming you have a controller bean that uses a DAO (implemented using an ORM tool like Hibernate) that updates two different databases, which should happen within the same transaction:
The trick here is that you�ll map the requests to a proxy bean (
removeTransactionController), which will actually do the transaction management for you (Spring uses the cglib api in order to build this proxy bean at runtime):
If your app doesn�t use global transactions, then using the
HibernateTransactionManager could be your best choice with spring-hibernate applications:
Basically this is how it works.
Regards.