First,
which RBDMS are you using? Which driver? does it support transactions? what
about XA transactions?
Nested
transaction involves the transaction demarcation of the methods,
therefore:
A)
SessionFacade.facade(){ bean.setA(); bean.setB();}
If setA() is marked as REQUIRES_NEW, then it's a nested
transaction on its own; it's failure will rollback
everything.
If setB() is marked as
REQUIRES_NEW, then it's a nested transaction on its own; it's failure will
rollback the outer transaction, but not the transaction fired by
bean.setA();
So, it might or might not be
a nested transaction; how have you demarcated the methods setA() and setB()
?
If you didn't mark setA() as REQUIRES_NEW, then there's
no nested transaction (as far as I can
see).
B)
EntityBean.updateBean(){ setA(); setB(); }
Same as above, it depends on the
demarcation.
HTH,
Juan Pablo Lorandi
Chief Software
Architect
Code Foundry Ltd.
Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050 Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com
Disclaimer:
Opinions expressed are entirely
personal and bear no relevance to opinions held by my employer.
Code Foundry Ltd.'s opinion is that I
should get back to work.
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Denis Wang
Sent: Wednesday, January 22, 2003 2:28 PM
To: [EMAIL PROTECTED]
Subject: is this a nested transaction problem? what is a nested transactionHello, all,
I am using CMP for session facades and two local entity beans. Both entity beans and the session facade are put into CMP with transaction option of 'required' in ejb-jar.xmlIn my SessionFacade.facade() method, I call EntityBean1.bean1() and then EntityBean2.bean2(). My intention is to roll back the facade() transaction if either bean method is failed. However, I observe that, once bean1() is returned the database will be updated. If there is an exception thrown from bean2(), no roll back happens.This is totally against my assumption. I am not sure whether it is caused by nested transaction not supported by EJB2.0 and weblogic currently.I will appreciate it if any one can provide a definite answer.Another related question is, which one of the followings is qualified as a 'nested transaction'? My intention is to have a coarse update for my entity bean.A) SessionFacade.facade(){ bean.setA(); bean.setB();}B) EntityBean.updateBean(){ setA(); setB(); }Answer 1: A) but not B)Answer 2: both A) and B).Thanks,Denis
