permaculture playing cards*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock Exam Question 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 "Mock Exam Question" Watch "Mock Exam Question" New topic
Author

Mock Exam Question

Alibabra Sanjie
Ranch Hand

Joined: Feb 09, 2004
Posts: 147
1) Session bean class must implements javax.ejb.SessionBean? True or False?

2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)
[ May 16, 2004: Message edited by: Alibabra Sanjie ]

Alibabra
Shahfazal Mohammed
Ranch Hand

Joined: Jan 08, 2004
Posts: 41
Answer (1): True, implementing javax.ejb.SessionBean gives you the 'beanie attributes' (SessionContext, container callbacks) and lets the Container kick in to provide its services like security, transactions etc.

Answer (2): i. EJB Container crash
ii. Bean times out while passivated state
iii. Bean throws system exception.

and I'm finding it kinda hard to understand what you try to mean in the third question. maybe some clarification would help me.

Also, can you please post where you get/got these questions from???

hope this helps-


-peace.
Alibabra Sanjie
Ranch Hand

Joined: Feb 09, 2004
Posts: 147
Thank you, Shahfazal Mohammed! And Sorry for the confusion of my second question. Please refer the edited question in my first post again for the correctness.

Regarding your answer (1). Because of the word "MUST" in the question, I can argue that it is not necessary to implementing javax.ejb.SessionBean directly, instead I can extends myClass which implementing javax.ejb.SessionBean. In this case, it is only indirect to implement javax.ejb.SessionBean. So it's incorrect. What do you think?
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The bean would still be a javax.ejb.SessionBean as it IS-A SessionBean.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Girija Siva
Ranch Hand

Joined: Apr 23, 2004
Posts: 41
2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)
the answer is false. When remove()ia called EJBRemove() will be called
Alibabra Sanjie
Ranch Hand

Joined: Feb 09, 2004
Posts: 147
2) Which cases can cause a session bean instance to be destroyed without the container calling ejbRemove()? Answer: The client invokes the remove method while the bean is in transaction (True or False?)

the answer is false. When remove()ia called EJBRemove() will be called


The client invoking the remove method while the bean is in transaction will result in Runtime Exception. When the bean receive runtime exception, the bean will be destroyed by the container without calling ejbRemove(). What do you think?
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
No, the client of a stateful session bean cannot remove a session object whilst the bean is in a transaction. Any attempt to do this will cause the container to throw javax.ejb.RemoveException to the client.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mock Exam Question