| Author |
Does Session bean's createMETHOD in home interface must throw "CreateException"?
|
hover cheng
Ranch Hand
Joined: Feb 11, 2003
Posts: 66
|
|
Hi, all I think it's ambigous because in "7.10.3 ejbCreate<METHOD> methods", EJB spec 2.0, it says:
In my opinion, the CreateException is optional. However, according to An SCBCD certification primer, the second question:
Consider the following session bean home interface located through the Java Naming and Directory Interface (JNDI). Context initialContext = new InitialContext(); ProcessPaymentHome ppHome = (ProcessPaymentHome) initialContext.lookup(�java:comp/env/ejb/pphome�); Which exceptions must be declared in the signatures of the methods contained in the ProcessPaymentHome interface? Choices A. RemoteException B. FindException C. Any application specific exception D. CreateException E. RuntimeException Correct choice: C; D
It assert that the CreateException is mandatory for create<METHOD> in session bean's home interface...
|
SCJP 91% SCJD 94% SCBCD 98% SCWCD1.4 86%<p>XML141 SCDWJS -- in progress<br />If you don't retreat, you are mostly among those who can surmount it.
|
 |
hover cheng
Ranch Hand
Joined: Feb 11, 2003
Posts: 66
|
|
Answer my own old question The CreateException need not to be defined to be thrown in the home interface for session bean.
|
 |
Seema Manivannan
Ranch Hand
Joined: Sep 20, 2001
Posts: 128
|
|
The rule you have stated is regarding the ejbCreate() methods in the session bean class. However, in the case of create() methods in the home interface of a session bean, the specification clearly states: "The throws clause must include javax.ejb.CreateException". Please check out Section 7.10.8 of the Specs. Thanks seema [ October 15, 2003: Message edited by: seema manivannan ]
|
Seema Manivannan<br />Author and Trainer: Java Certifications<br /> <br />Whizlabs Software<br />Success, certified!<br />Global leader: J2EE certification exam preparation!<br /><a href="http://www.whizlabs.com" target="_blank" rel="nofollow">http://www.whizlabs.com</a><br /> <br />An ISO 9001-2000 certified company!
|
 |
hover cheng
Ranch Hand
Joined: Feb 11, 2003
Posts: 66
|
|
seema, You are right. Thanks for your correction.
|
 |
 |
|
|
subject: Does Session bean's createMETHOD in home interface must throw "CreateException"?
|
|
|