Refine Transaction Management

Need:

Current Implementation
Currently, transactions are managed either using a custom annotation mechanism at the level of the Struts Action classes or using a custom HibernateUtils class that makes use of a Hibernate session stored in a thread local variable.

Proposed Improvements

First we would move transaction management out of the presentation layer and the business objects as mentioned above and centralize it in the service layer.

To do this, we could make use of the Spring transaction management functionality to standardize the treatment of transactions and eliminate the custom annotation based mechanism and HibernateUtil mechanism. If possible we could use spring declarative transactions to cleanly separate transaction management from the code which depends on transactions.

Anticipated Benefits

  1. Increase developer productivity
  2. Reduce transaction related bugs

By simplifying transaction management it will make it easier for developers to know how to correctly use and manage transactions.

Suggestions: