• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

ejbCreate()??

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
who says it is not valid?
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CreateException is not mandated by the EJB spec for a session bean class, although some EJB servers require this exception to be declared.
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srikanth,
So the correct answers are a,b,c .Right???
just started the SCBCD preparation.

Thanks
shanthisri
 
srikanthD reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess the ejbCreate.... methods should be of void return type
Correct me if i am wrong

Thanks,
Shrimon
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic