Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

DAOs and Connection handling

Jaise George

2004-04-21


Message

Hi,

I have a doubt on DAOs and Connection handling...

In my application, I have a Session Faccade (Stateless Session Bean) which accesses a Business Object which in turn calls about three Data Access Objects to perform the database operations. The transaction attribute for the method is the Session Bean is set as "Required". The application uses a DataSource for obtaining the Database Connection. All the three DAOs are using separate connection objects.

My doubts are:
1. If I roll back the transaction at any stage will all the three connections get rolled back?

2. Is it a good idea to obtain separate connections for the DAOs that are taking part in same transaction? Or I should create a connection outside the DAOs and pass it to all the DAOs.

3. Is DataSource.getConnection() an expensive call that will degrade the application performance.

Somebody please help....

Thanks & Regards

Jaise
 
=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

©2008 junlu.com - Jax Systems, LLC, U.S.A.