nerdexam
Oracle

1Z0-860 · Question #16

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…

The correct answer is D. return (Bar) sessionCtx.getBusinessObject(Bar.class). See the full explanation below for the reasoning.

Question

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.}

Options

  • Areturn (Bar)t his;
  • Breturn (Bar) new FooBarBeanQ;
  • Creturn (Bar) sessionCtx.lookup("FooBarBean")
  • Dreturn (Bar) sessionCtx.getBusinessObject(Bar.class);
  • EInitialContextic= new InitialContextQ;

How the community answered

(32 responses)
  • A
    6% (2)
  • B
    3% (1)
  • C
    13% (4)
  • D
    75% (24)
  • E
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-860 Practice