aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Question about transactional attribute and session beans.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about transactional attribute and session beans...." Watch "Question about transactional attribute and session beans...." New topic
Author

Question about transactional attribute and session beans....

SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
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
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about transactional attribute and session beans....