Re: EJB Transaction
"Kalra, Ashwani" <[email protected]> Wed, 16 Aug 2006 16:06:07 +0530
| Newsgroups | gmane.comp.java.sun.ejb.general |
|---|---|
| Message-ID | <2F5A22140B3D99469B1D5963D0E1E4265522D8@BOMEX002.corp.capgemini.com> |
=20 > >Considering the above scenario, will all the method calls=20 > above falls into 1 transaction?=20 =20 No each thread from servlet is different transaction=2E So in=20 this case with required attribute two different transactions=20 run one after another =20 > >Is rollback possible in this scenario? =20 Yes, its upto you how you handle it=2E If System exception is=20 thrown, transaction will be rolled back automatically by=20 container in each flow you mentioned=2E So its upto you if you=20 want to continue to next call =20 =20 > >If the ear is deployed into the same application server, even to=20 > >different container (serlvet deployed to servlet >>>>=20 > container, EJBs deployed to EJB container), are the objects=20 > sharing the same JVM? Cannot say, but its always suggested not to assume such=20 things while coding=2E Why do you want to know?=20 =20 > >I have read about EJB transactions, but the information that I found=20 > >are mainly for EJB to local/remote EJB kind, is > there any=20 > information=20 > >that you can recommend me to read about transaction=20 > behaviour that relates to EJB to POJO or vice versa? >=20 Pojo calls are equivalent to normal method calls=2E So in your=20 case it doesn't matter if you use POJOs or not unless you are=20 not doing any thing special like starting some transaction etc=2E=20 =20 /Ashwani >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > ________________________________ >=20 > From: A mailing list for Enterprise JavaBeans development=20 > [mailto:EJB-INTEREST@JAVA=2ESUN=2ECOM] On Behalf Of Karen Low > Sent: Wednesday, August 16, 2006 8:27 AM > To: EJB-INTEREST@JAVA=2ESUN=2ECOM > Subject: EJB Transaction >=20 >=20 > Hi, >=20 > I was trying to find out what will be the transaction like=20 > for the following scenario: >=20 > Imagine a servlet method get invokes and it's a deep request=20 > which does 2 db calls, one is insert, another one is update=2E=20 >=20 > Action class (Servlet): > ---> Stateless Session Bean (1) ---> POJO --->=20 > Stateless Session Bean (2) ---> POJO (DAO) =3D=3D> DB (insert) > ---> Stateless Session Bean (1) ---> POJO --->=20 > Stateless Session Bean (2) ---> POJO (DAO) =3D=3D> DB (update)=20 >=20 > Legend:=20 > ---> calls a method > =3D=3D> DB sql execution >=20 > All EJBs are container managed with transaction attribute set=20 > to "Required"=2E All classes mentioned above are packaged into=20 > one ear and deployed into 1 app server=2E=20 >=20 > Considering the above scenario, will all the method calls=20 > above falls into 1 transaction? Is rollback possible in this=20 > scenario? Are they consider in the same session? If the ear=20 > is deployed into the same application server, even to=20 > different container (serlvet deployed to servlet container,=20 > EJBs deployed to EJB container), are the objects sharing the=20 > same JVM?=20 >=20 > I have read about EJB transactions, but the information that=20 > I found are mainly for EJB to local/remote EJB kind, is there=20 > any information that you can recommend me to read about=20 > transaction behaviour that relates to EJB to POJO or vice versa?=20 >=20 > Any thoughts and experience shared are much appreciated=2E >=20 > Thank you very much=2E >=20 > Regards, > Karen > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D To unsubscribe, send email to=20 > listserv@java=2Esun=2Ecom and include in the body of the message=20 > "signoff EJB-INTEREST"=2E For general help, send email to=20 > listserv@java=2Esun=2Ecom and include in the body of the message "help"= =2E=20 >=20 This message contains information that may be privileged or confidential= and is the property of the Capgemini Group=2E It is intended only for the= person to whom it is addressed=2E If you are not the intended recipient, = you are not authorized to read, print, retain, copy, disseminate, = distribute, or use this message or any part thereof=2E If you receive this= message in error, please notify the sender immediately and delete all = copies of this message=2E =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D To unsubscribe, send email to [email protected] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [email protected] and include in the body of the message "help".