wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes JTA TRANSACTION-BEAN MANAGED TRNSACTION, NO ROLLBACK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JTA TRANSACTION-BEAN MANAGED TRNSACTION, NO ROLLBACK" Watch "JTA TRANSACTION-BEAN MANAGED TRNSACTION, NO ROLLBACK" New topic
Author

JTA TRANSACTION-BEAN MANAGED TRNSACTION, NO ROLLBACK

ganesh jadhav
Greenhorn

Joined: Mar 13, 2009
Posts: 8
hi All,

I have a stateless session bean, with bean managed transaction.
the code is like this...
doTask()
{
try
{
utx=getUserTransaction();
utx.begin();

method1(); //in this i am updating few table in DB -DB connection is taken in the same method and closed there
method2(); // calling a stored procedure to do smthing etc
method3(); //update smthing else

utx.commit();
}catch(Exception y)
{
utx.rollback();
}

}

in all method1(), method2(), method3() , i have taken DB connection from Connection pool and closed in those methods only,

I am not using anything like connection.setAutocommit(false/true), in anywhere in the code.

if method3() goes down then it should rollback the db changes made in the method1 and method2.??? But it does not rollback the txn properly.

Is there any other way, I am stuck and can not go for
JDBC transactions at this stage, since i will have to do a lot of changes.

The application is on weblogic10 mp1.

Please let me know the reasons for the failure for the rollback.





Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


if method3() goes down then it should rollback the db changes made in the method1 and method2.??? But it does not rollback the txn properly.

So...what does it do? Rollback nothing at all?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Ganesh,

Are these methods doing their own BMT also? If so, that would be the cause of the problem. BMT transactions do not join existing transactions. Also, what is the need for BMT at all?

Hope it helps,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
ganesh jadhav
Greenhorn

Joined: Mar 13, 2009
Posts: 8
Its' not rollbacking anything at all.

Is there any problem in using BMT???

Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Ganesh,

As I mentioned, BMT transactions do not participate in any existing transactional contexts (we talk about this in the book). If you are using BMT in *all* your methods, there would not be a "global" rollback. Also, BMT should be used only when CMT is not sufficient. Again, we talk about this in the book. Whatever reference you are using should be doing the same, so I would take a look there first.

Regards,
Reza
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTA TRANSACTION-BEAN MANAGED TRNSACTION, NO ROLLBACK
 
Similar Threads
USER TRANSACTION , STATELESS SESSION EJB , NEED FEW TIPS
BMT not propogated to invoked beans
MDB transaction rollback
Stateful Session Bean Discard
Passing Object vs Explicit DOT.calls