It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes My mock exam questions. 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 "My mock exam questions." Watch "My mock exam questions." New topic

My mock exam questions.

Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
My question about the mock exam is ,

1. which one of the following is a valid stateless bean component interface?
A. public interface Foo extends javax.ejb.EJBLocalObject {
Foo create();

B. public interface Foo extends javax.ejb.EJBLocalObject {
void method();
void method(float param);

My thought is both of them are valid, but there is only one correct answer

sending a JMS message from within the setMessageDrivenContext

is that action valid? the EJBPlus said that is right, however I can not find related description in EJB Spec

Which three method of stateful session bean are called with an
unspecified transaction context?
A. constructor
B. afterBegin
C. afterCompletion
D. beforeCompletion

I think only the constructor and afterCompletion is correct answer, but is ask for 3 correct answer
[ September 24, 2005: Message edited by: Zee Ho ]

SCJP 1.4<br />SCWCD 1.3<br />SCJD<br />SCBCD<br />IBM Xml Cert in progress
Muhammad Saeed

Joined: Sep 10, 2005
Posts: 23
In my opinion;

1) Option 'B' seems right, "Foo create();" can be the part of local home
interface instead.

2) We can't Access JMS Resource Manager Connection factories from
setMessageDrivenContext, the only place we can access JMS RMCF is
onMessage(), hence statement seems invalid.

3) I don't see third correct answer. Options A and C should be the only
correct choices.

Corrections to above replies would be appreciated.


SCJP<br />SCBCD<br /> <br />***Brains, like hearts, go where they are appreciated***
Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
Thx for ur reply, but for the 1st question, why A is incorrect? is it because of the return type or whatever? I think for the method name itself is not invalid, also, I do think write a method named create is really confused, but is it not allowed?(as the create can be one of the business method with bad name)
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
Don't lose any sleep over these junk questions.

Whoever came up with (1) probably wanted to see if you could tell the difference between a Home interface and a Component interface - I can't cite a reason why (A) is wrong - though its suspect, you better have a good reason for returning another instance (or the same?) of the component interface of a stateless object that theoretically has exactly the same capabilities as the current one (because it lacks state). I can't think of one. I think someone simply clobbered a Home interface to see if you could tell the difference between a component interface and a home interface.

(2) Pretty much the only thing you can do in setMessageDrivenContext other than storing the context reference, is using JNDI. Any accesses to any resource managers or invocation of other beans has to wait until onMessage().

(3) In this one you would have been well within you rights to say that only (A) is valid. The other three aren't even available unless your stateful session bean implements the SessionSynchronization interface which you can only use with CMT - which the question does not explicitly mention (and it certainly does not occur by default). And as you indicated, even if you do implement SessionSynchronization, afterBegin and beforeCompletion occur within the transaction - calls to getRollbackOnly() and setRollbackOnly() are valid during those methods.
Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
thx for reply. now got it.
I agree. Here's the link:
subject: My mock exam questions.
It's not a secret anymore!