Meaningless Drivel is fun!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes transaction exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "transaction exceptions" Watch "transaction exceptions" New topic
Author

transaction exceptions

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Howdy!


I have two SLSB (A and B) with methods:



I suppose that bean A will receive EJBException and can continue with the transaction if the excepion is caught? If the exception is not caught then bean A is discarded?
The transaction of B is rolledback and bean B is discarded?

Am I right?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
ramesh vanka
Greenhorn

Joined: Mar 13, 2005
Posts: 11
In EJBs, we have 2 type of exceptions are there
1) System Exception
2) EJB Exception

Transaction {
BusinessMethod1();
BusinessMethod2();
BusinessMethod3();
}

While performing above transaction, if any exception has happend

1) If Exception is System Exception:
Then Container will come into picture, rollback the data.

2) If Exception is EJB Exception:
Then developer will handle that the exception.


In your case.

Inside Session Bean A Business Method, user calling the Session Bean B Business Method.

Session Bean B business Method throws Exception, so that Session Bean A business method not handle the exception, it is ejb exception. User should take care while handling these excepions.



Anirudh Gupta
Ranch Hand

Joined: Dec 08, 2010
Posts: 48

I suppose that bean A will receive EJBException and can continue with the transaction if the excepion is caught? If the exception is not caught then bean A is discarded?


Yup!!

The transaction of B is rolledback and bean B is discarded?


Yup AGAIN !


Regards,
Anirudh
 
wood burning stoves
 
subject: transaction exceptions