Which two statements are correct for making this code work as a stateless session bean, considering that this session bean is NOT defined in a deployment descriptor and the interfaces do NOT have annotations? (Choose two.)
A - Only the interface for remote usage must be annotated.
B - The interfaces B1 and B2 can only be used locally without changing the code.
C - Both interfaces B1 and B2 must be annotated to make this a working stateless session bean.
D - The interfaces B1 and B2 can be annotated differently, one with @Local and the other with @Remote.
SCJP, SCWCD5, SCBCD5, SCDJWS
IBM Certified Websphere 6.1 Core Admin
IBM Certified SOA Solution Designer
SCEA Part 1
I would answer C and D. I think C is correct because my understanding is that if a sesssion bean implements a single interface then it defaults to Local whereas if a session bean implements two (or more) interfaces there must be explicitly annotated or defined in the deployment descriptor. I think D is correct beacuse I can't see any issue with a seesion bean implementing both Local and Remote interfaces (I'm sure that the O'Reilly EJB 3.0 gives an example of this in Chapter 11).
I'll take a look at the spec to see whether my understanding is correct. Meanwhile if anybody knows for sure I'd be interested in the answer and the reasoning.
• If bean class implements a single interface, that interface is assumed to be the business interface of the bean. This business interface will be a local interface unless the interface is designated as a remote business interface by use of the Remote annotation on the bean class or interface or by means of the deployment descriptor.
• A bean class is permitted to have more than one interface. If a bean class has more than one interface excluding the interfaces listed below—any business interface of the bean class must be explicitly designated as a business interface of the bean by means of the Local or Remote annotation on the bean class or interface or in the deployment descriptor.
Joined: May 17, 2006
Hi Karnati Sudhakar,
Keep in mind that this behavior may be specific to a App Server (I guess this is jboss) . So be careful in the exam. exam totally focuses on the spec.