I have a strange problem. In a servlet, I am starting a Transaction
UserTransaction ut = mySessionCtx.getUserTransaction();
and trying to update two tables thru two Entity Beans .
If both go through successfully i am committing the changes
using
ut.commit();
else I want to roll back. My problem is the first update changes are getting commitied even if the second update is failing . When the second update fails it is giving me a message saying Tansaction Rolled Back but still the first update changes are not being rolled back. The transaction attributes of the session bean are TX_BeanManaged and for Entity beans TX_Supports Any Help please !!!
Akmal.
-
JTA and rollback problems (3 messages)
- Posted by: Berb Akmal
- Posted on: June 12 2001 12:55 EDT
Threaded Messages (3)
- JTA and rollback problems by Hemant Khandelwal on June 12 2001 13:50 EDT
- JTA and rollback problems by Berb Akmal on June 13 2001 06:23 EDT
- JTA and rollback problems by sujoy das on August 09 2001 06:40 EDT
- JTA and rollback problems by Berb Akmal on June 13 2001 06:23 EDT
-
JTA and rollback problems[ Go to top ]
- Posted by: Hemant Khandelwal
- Posted on: June 12 2001 13:50 EDT
- in response to Berb Akmal
Hi Akmal,
Can you try the following steps to troubleshoot your problem ?
1. Obtain a connection from the dataSource (data source to which entity beans are mapped.)
2. On the connection object call getAutoCommit() and check its value. The value, IMO, shouldnt be true.
Regards,
Hemant
Pramati Technologies
www.pramati.com -
JTA and rollback problems[ Go to top ]
- Posted by: Berb Akmal
- Posted on: June 13 2001 06:23 EDT
- in response to Hemant Khandelwal
Thanks Hemant,
I was slightly wrong in the way I phrased the problem. I am dealing with Enterprise Session (Stateless) Beans not Entity beans (my fault sorry!). The Stateless Session beans use db helper classes instead of Entity beans to do inserts. So I am not sure if you suggestion will work. Any other ideas.
Thanks Again,
Akmal. -
JTA and rollback problems[ Go to top ]
- Posted by: sujoy das
- Posted on: August 09 2001 18:40 EDT
- in response to Berb Akmal
Hi Akmal,
I am also facing the same problem. I am using Weblogic5.1 .My code looks like the following.
try{
ut = (javax.transaction.UserTransaction)initial.lookup("javax.transaction.UserTransaction");
ut.begin();
calling db method 1 on another bean
calling db method 2 on another bean
ut.commit()
}
catch(Exception e){
.....
ut.rollback();
...
}
When autocommit is true:
When the method 2 fails method 1 still commits the changes in the database.
When autocommit is false:
When both the method passes still none of them commits the changes in the database.
If you got any solution to your problem please respond me.