This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about transactional attribute and session beans....

 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic