File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Container Managed Transactions

 
Ravi Singh
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic