File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ejbCreate method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ejbCreate method" Watch "ejbCreate method" New topic

ejbCreate method

sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Is ejbCreate method in the entity bean class must specify javax.ejb.CreateException in the throws clause. In the specs page no 192 its written that "the throws clause must specify javax.ejb.CreateException". I tried with weblogic,websphere it works if u don specify it.


Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
Did you actually create and entity? Did you try introducing some problem and check? Does your home interface create method throw the CreateException? [the bean directly does not implement the home interface but internally the ejbCreate method gets called when the client goes for create]

Did you try any other type of bean?

ejbCreate methods are not checked by the compiler as it is not in any interfaces that we implement for a bean. So check the runtime behaviour.


sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
I do understand that the home interface is not implemented by the bean . I tried creating the bean and it works. The create method in the home interface is required to throw the CreateException for both local or remote interfaces but the ejbCreate() in the bean class is not required to specify the CreateException in throws clause. But again on page 192 the spec says that it must throw.

Well it works (both compile time and runtime).

I agree. Here's the link:
subject: ejbCreate method
Similar Threads
Home Business Methods
Confirmation Required
Throw CreateException in callbacks
Exception question for *REAL EJB MEN* (ok, Kathy, for REAL J2EE GIRLS too)
Is a CreateException in the method-declaration necessary?