Any enterprise-class application that interacts with databases needs to take care of transactional integrity across database tables, databases, and components. Typically you achieve this either by using the heavy plumbing of application servers or by leveraging the Java Transaction API (JTA) at code level. Both approaches have their merits and demerits.
In the case of application servers, someone has to pay for all the infrastructure services, but the server platform does provide an out-of-the-box solution for cross-cutting concerns like security, transaction, and persistence. Server infrastructures like those provided by BEA or IBM address the full process associated with architecture, prototype, design, development, packaging, deployment, and monitoring.
If instead you go for direct JTA API integration at the application code level, you don't need to pay for the additional server infrastructure, but you may end up with business logic mixed with infrastructure-level code.
It is in this context that you need to think of lightweight containers that will help you wire application logic components with infrastructure services like transaction handling without the necessity of having a full-blown application server. Spring is one such lightweight container that uses Aspect Oriented Programming (AOP) techniques for integrating cross-cutting services with components. This article walks you through a running example implemented using a mix of three powerful, complementary J2EE technology frameworks: Spring, Hibernate, and JOTM.