• 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

Q: transaction mgt in session bean wrapping JDBC

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have some confusion as to what happens in a session bean that makes JDBC calls.

Say a stateless session bean has "Required" transaction attribute on its bussiness method, this method uses JNDI to look up data source and get a connection, and then updates database.

How would a J2EE container know this connection is part of the EJB's transaction? Is this something required by J2EE
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically yes it is required. When the App Server provides transaction processing, it has to monitor the entire transaction and provide all the necessary means to hold everything within the method, including JDBC stuff within that transaction.

I would suggest that the stuff done to the database be put into a POJO, most likely a DAO object, than hvaing that code directly in the Session Bean.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic