• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about transactional attribute and session beans....

 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic