I know that one of the benefits of using EJB is to offset the responsibility of transaction management to the EJB container, allowing developers to concentrate on business-specific features. At the moment, we are implementing a 3-tier system which consists of JSP on the front end, stateless session beans on the app server as a facade to a data access layer, and of course Oracle database in the back end. The data access layer consists of java classes that use JDBC to manipulate the database. The stateless session bean layer allows distributed access to our JDBC calls in the data access layer. So my question is this: Since you can specify transactional attributes at the method level for stateless beans, would this imply that the EJB container will handle transactions for JDBC calls made from my data access layer? in other words, should I avoid using setAutoCommit(), commit(), and rollback() from my data access layer? thanks, SAF
The answer is YES, absolutely! So long as you use the JDBC 2.0 DataSource classes to obtain all of your JDBC connections (and not DriverManager) then the EJB container will handle transactions for you. This is one of the advantages of EJB. In fact DO NOT TOUCH the transaction control methods on the Connection. Avoid them at all costs! Kyle
Actually, we plan to use Weblogic 6.1 connection pooling, so I'm sure that Weblogic is using javax.sql for all connections. Are you sure this will work? Can you point me in the direction of some sample code displaying this concept at work, or perhaps a good book? Does your book provide concrete examples for this concept? thanks Kyle, SAF
subject: Question about transactional attribute and session beans....