Which code, when inserted on Line 12 below, implements the getBar method with the wanted behavior?

A developer writes a stateful session bean FooBarBean with two local business interfaces Foo
and Bar. The developer wants to write a business method called getBarfor interface Foo that
returns a Bar reference to the same session bean identity on which the client invokes getBar.
Which code, when inserted on Line 12 below, implements the getBar method with the wanted
behavior?
10.©Resource SessionContext sessionCtx;
11. public BargetBarOJ
12.
13.}

A developer writes a stateful session bean FooBarBean with two local business interfaces Foo
and Bar. The developer wants to write a business method called getBarfor interface Foo that
returns a Bar reference to the same session bean identity on which the client invokes getBar.
Which code, when inserted on Line 12 below, implements the getBar method with the wanted
behavior?
10.©Resource SessionContext sessionCtx;
11. public BargetBarOJ
12.
13.}

A.
return(Bar)this;

B.
return(Bar) new FooBarBeanQ;

C.
return (Bar) sessionCtx.lookup(“FooBarBean”)

D.
return (Bar) sessionCtx.getBusinessObject(Bar.class);

E.
InitialContextic= new InitialContextQ;
return (Bar) ic.lookup(“java:comp/env/ejb/FooBarBean”);

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *