jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes TX in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "TX in servlets" Watch "TX in servlets" New topic
Author

TX in servlets

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi.
My web application uses DataSource as the interface of database operations.
My servlet has to group the following operation in a single transaction :
// insert new record in table1
// insert new record in table2
// update a row in table3
How to use transaction here ?
Should I use TransactionManager (JTA) ? or use original transaction like setAutoCommit( ) ?
In the case if I have to use JTA, I have to put jta.jar in Tomcat classpath, right ?
Thanks.
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

Hi todd..

i think if u use small TX better go for the SetCommit();
at last once all the Tx are sucess else roll back i think as far as my knowledge and expis concerned if u have time and ur appln extends more ..its reallly better t use JTA...

Let me know if it is OK

Thx and Regards
G R Ganesh Gowtham
grgowtham_cse@yahoo.com
Capricornsys inc, Hyderabad


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: TX in servlets