This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Need confirmation from experts. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Need confirmation from experts." Watch "Need confirmation from experts." New topic
Author

Need confirmation from experts.

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
/**
* Call back methods cannot declare to throw Checked Exception.
* If done the bean will not be deployed and will generate an
* error as incorrect callback signature.
*
* Callbacks can declare to throw RuntimeException. If
* PostConstruct throws a RuntimeException, the bean instance
* is destryoed and PreDestroy method is not invoked.
*/
/**
* Business method can be declared to throw Checked exception.
* The bean instance is not removed from service.
* @throws Exception
*/
/**
* Business method can be declared to throw Runtime exception.
* When the business method throws Runtime exception, PreDestroy
* is invoked before the instance is destroyed.
* @throws RuntimeException
*/


Please confirm, if the above statements are correct. I have verified them before coming up with these points.
I just want to confirm with the experts.


SCJP, SCWCD, SCBCD
LakshmiNarayana Kodali
Greenhorn

Joined: Oct 30, 2008
Posts: 16
The 1st,2nd and 3ed statements are correct.

4th statement is wrong.

If the bean instance method ( Business or lifecycle callback method ) throws runtime exception, @PreDestroy callback method will not be called. It will be missed

-------------------------------------
LakshmiNarayana Kodali
SCJP 5(98%), SCWCD(100%), SCBCD in progress
 
wood burning stoves
 
subject: Need confirmation from experts.
 
Similar Threads
ets question on setrollbackonly
Session Beans and SessionBean interface.
Exception Doubt
Application Exception in MDB
ETS Question doubts