• 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

Container Managed Transactions

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If a stateless bean method, which is part of a larger transaction, updates a database table directly using a standard JDBC connection and SQL statements are the changes made written to a 'cache' and only applied when the entire transaction succeeds and is committed to the database?

For example,


Public void makeChange {

Connection con = // Get Connection

Statement stmt = con.createStatement();

stmt.executeQuery(�INSERT INTO TABLE VALUES 50�);

con.close{}
}


Are these changes only made to the database when the entire transaction (which this method is a part of) succeeds?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pretty much. The mechanics of exactly how this happens is down to vendor specific implementations, but you've got the gist of it.
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That�s the way we go about doing things here at my place.
just 1 wrapper to wrap all the transaction be it just one of or a multiple Data manipulation in the db,
it should work fine.
as long as your session bean does not start a new one but supports the existing trans,

Check to make sure please,

Hope that helps

Cheers,
Parthi.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection's auto-commit mode is disabled, enabling all the DB updates to be committed or rolled back at the end of a transaction.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic