File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Entity bean question - HFEJB pag 363, exe: 5! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "Entity bean question - HFEJB pag 363, exe: 5!" Watch "Entity bean question - HFEJB pag 363, exe: 5!" New topic
Author

Entity bean question - HFEJB pag 363, exe: 5!

Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
We do have the following question:

Which are LEGAL declarations for a CMP beans's ejbCreate methods? (choose all that apply)

A - public void ejbCreateBigCustomer() throws javax.ejb.CreateException

B - public String ejbCreateAccount() throws javax.ejb.CreateException

C - static String ejbCreate() throws javax.ejb.CreateException.

D - public int ejbCreate() throws javax.ejb.CreateException.

C - public final String ejbCreate() throws javax.ejb.CreateException.

The book says that the correct answer is option B.

My question is..why isn't the option D considered correct as well?

Tks so much!!!


SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Must not be static.

Spec says

The method name must have ejbCreate as its prefix.
The method must be declared as public.
The method must not be declared as final or static.
The return type must be the entity bean�s primary key type
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Hi Amon, how are you??

Well..dind't understand..Are you talking about option C or D ?
I'm talking about the option D.

According to your note :

The method name must have ejbCreate as its prefix.
- ok, D option does have!

The method must be declared as public.
-It's .

The method must not be declared as final or static.
- It's not NEITHER FINAL nor STATIC.

The return type must be the entity bean�s primary key type
- int primitive type is fine. (is it fine?)

Does it make sense???

Tks so much!!
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
please can anyone advise?

Tks!!!
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
ejbCreate() must return primarykey.
primarykey can be either be class or it can be object type(like String,Integer etc)
But it cannot be primitive(like int)
Now
public int ejbCreate() throws javax.ejb.CreateException.
returns int which i think is Wrong.
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Whoops misread the question in hurry

gowher is right, the primary key field cannot be primitive

it has to be a subclass of java.lang.Object.
It need not be String or wrapper classes like Integer,Long..
you can define your own class as a primary key.
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Hi gowher and Amol!!!

Ahhhh, got it!! no primitive types so!!

Tks so much!!!

Hugs []'s
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Entity bean question - HFEJB pag 363, exe: 5!
 
Similar Threads
Mock Question HFEJB page 368. Q5.
Coffe Cream on EB - Mistakes/Doubt #2
HFEJB Page 368, Q # 5
need explanation
Mock Exam HF EJB