Mahesh Joshi wrote:
I have always wondered where is the best place to do connection management
with the dataStore. Should the business Logic do connectionManagement (e.g. opening a connection
(via a connection pool or otherwise)) or should that be the responsibility
of the persistence layer. Doing it in the latter(PersistenceLayer) frees up
the BusinessLayer of connection Mgt code. If you are implementing connectionpool, the overhead is the time to return
the connection to the pool and get it back.

The iBATIS DAO splits the difference and makes transaction management part of the logical DAO API. So you can specify different connection mechanisms at instantiation, and the implementating code does not need to know the details. The DAO implementation can just call high-level methods like startTransaction, commitTransaction, or rollbackTrnasction.


This strategy limits what the implementaton needs to know about the connection management, but still lets the business logic determine what constitutes a transaction (which is often a business decision).

-Ted.


-- Ted Husted, Junit in Action - <http://www.manning.com/massol/>, Struts in Action - <http://husted.com/struts/book.html>, JSP Site Design - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to