aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes need explanation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "need explanation" Watch "need explanation" New topic
Author

need explanation

srinija kosaraju
Greenhorn

Joined: Sep 08, 2004
Posts: 17
These questions are from HFE

1.which are legal declarations for a CMP bean's ejbCreate methods

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

E.public final String ejbCreate() throws javax.ejb.CreateException


I know A,C,E cannot be the answers.But why D cannot be the answer.For entity beans ejbcreate method returns a PrimaryKey.int can also act as a primarykey.


2.which method(s) from the EntityContext interface can be invoked from with in the ejbCreate method?

A.getEJBHome()
B.getEJBObject()
C.getCallerPrincipal()
D.getUserTransaction()
E.setRollBackOnly()

MyAnswers:A,C,E
Answers according to HFE:A,B,C,E

My doubt is how can B be the answer.Is it legal to call getEJBObject() from ejbCreate() of an entity bean.
container is not aware of the primarykey until the ejbCreate() returns.Then how can it prepare an EJBObject for the client,and how can we call getEJBObject();

3.which method(s) run in the transaction context of the method that causes their invocation?

A.ejbLoad()
B.ejbRemove()
c.ejbSelect()
D.ejbActivate()
E.ejbPassivate()
F.setEntityContext()

HFE Answers:A,B,C.

can any one please give the reason behind it.

thanks in advance
srinija
Paul Maessen
Greenhorn

Joined: Sep 27, 2004
Posts: 12
hi srinija,

1. because the primary key must be a *class*, so int is not OK but Integer is

2. you are right, it is not legal to call getEJBObject() from within ejbCreate()

3. the question should have been: which methods run in an unspecified transaction context? Answer D,E, and F. For the others the spec defines the transaction context in which they must run.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need explanation