You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Antony Paul <an...@hotmail.com> on 2004/09/21 13:01:25 UTC

[OT] Handling JDBC transactions

Hi all,
    What are the ways to handle transactions in Tomcat ?. No EJB here. I use
Tomcat standalone. I am using JDBC calls to manage DB. I had used
Connection.commit() and party in previous projects. But this have 2 draw
backs
1. Need to pass Connection to methods which is coming under the transaction.
2. Some methods may need to be transactional in future which are not
transactional now. Since now it is not transactional I am not passing the
Connection object. Hence it requires modification of the method signature to
implement the new changes which is not desirable in most cases.
    So I am looking for alternate ways. How you people handle this ?.

rgds
Antony Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: [OT] Handling JDBC transactions

Posted by QM <qm...@brandxdev.net>.
On Tue, Sep 21, 2004 at 04:31:25PM +0530, Antony Paul wrote:
:     What are the ways to handle transactions in Tomcat ?. No EJB here. I use
: Tomcat standalone. I am using JDBC calls to manage DB. I had used
: Connection.commit() and party in previous projects. But this have 2 draw
: backs
: 1. Need to pass Connection to methods which is coming under the transaction.
: 2. Some methods may need to be transactional in future which are not
: transactional now. Since now it is not transactional I am not passing the
: Connection object. Hence it requires modification of the method signature to
: implement the new changes which is not desirable in most cases.
:     So I am looking for alternate ways. How you people handle this ?.


This is a design issue.  With proper abstraction of/within your data
layer, you can minimize the amount of Connection-passing to a specific
set of database-related methods (preferably within the same object).

Create methods that handle business processes; in turn, these methods
call several (internal, private) methods that handle the Connection
object.

Look at the Thread-Safe Interface pattern for hints, then adjust as
needed to fit your situation.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org