aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ejbCreate()?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "ejbCreate()??" Watch "ejbCreate()??" New topic
Author

ejbCreate()??

srikanthD reddy
Greenhorn

Joined: Mar 21, 2006
Posts: 7
Hi..

Which of the following method declarations for a session bean class are valid?
Choices:
� A. public void ejbCreate(String name) throwsCreateException {}
� B. public void ejbCreateBigCart() throws CreateException{}
� C. public void ejbCreate(String name) {}
� D. public static void ejbCreateSmallCart() {}
� E. public final PKeyType ejbCreate() {}
� F. public PKeyType ejbCreateLargeAccount() {}

in the above question why option is c is not a valid one ...as far as i remember in the bean class an ejbCreate method may throw a create Exception but its not a must!!!

please clear the doubt!!

thanks
sri
Gopi Donthireddy
Greenhorn

Joined: Jun 21, 2005
Posts: 18
who says it is not valid?


Don<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCDJWS
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
CreateException is not mandated by the EJB spec for a session bean class, although some EJB servers require this exception to be declared.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
shanthisri mocherla
Ranch Hand

Joined: Sep 05, 2005
Posts: 119
Hi Srikanth,
So the correct answers are a,b,c .Right???
just started the SCBCD preparation.

Thanks
shanthisri
srikanthD reddy
Greenhorn

Joined: Mar 21, 2006
Posts: 7
yah shanthi... thats write ..even i feel that a,b,c are right ....but i came across this question somewhere i couldn't remember that says only a,b....ny how as most of them says its a,b,c ...my doubt is clarified ...

thanks a lot...

thanks
sri
Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
Something about the above thread was bothering me..so i decided to check it on an App Server

I used IBM Websphere 5.1

When you say, Session bean - you can mean Stateful or Stateless

When you say stateful - then out of the options given by you

� A. public void ejbCreate(String name) throwsCreateException {} Valid
� B. public void ejbCreateBigCart() throws CreateException{} Valid
� C. public void ejbCreate(String name) {} Valid
� D. public static void ejbCreateSmallCart() {} Not Valid(Using Static)
� E. public final PKeyType ejbCreate() {} Not Valid
� F. public PKeyType ejbCreateLargeAccount() {} Not Valid

When you say stateless the only acceptable scenario is ejbCreate() with no params.Any other option creates a violation of EJB 2.0:7.8 Check it out and do let me know if i am wrong


OCMJEA/SCEA, SCDJWS, SCBCD 1.3, SCJP 1.4
My SCEA experience:http://javalogue.blogspot.com/
satheesh krishnaswamy
Ranch Hand

Joined: Mar 17, 2004
Posts: 137
public void ejbCreateBigCart() throws CreateException{} Valid

How is this Valid? Shall we have like this ejbCreateBigCart()? or is this a typo.I feel it should be ejbCreate(argument) in case of Stateful and ejbCreate() without arguments in case of Stateless S.B.

Please correct me if I am wrong.


Regards,<br /> <br />Satheesh.K<br />-------------<br />SCJP 1.4<br />SCWCD 1.4
Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
As i said ..try it out...on an app server...the spec says multiple ejbCreate is supported.

Now since this worked i am assuming this means that all create methods which begin with the words ejbCreate*******() and so on so forth.

any Experts on this?
shri mon
Ranch Hand

Joined: Jan 11, 2005
Posts: 63
I guess the ejbCreate.... methods should be of void return type
Correct me if i am wrong

Thanks,
Shrimon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejbCreate()??
 
Similar Threads
Error from ejbc on ejbCreate and ejbPostCreate
legal ejbCreate method
ejb error
Mock Question
on ejbRemove() method...