This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes The only time a lookup is  needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "The only time a lookup is  needed" Watch "The only time a lookup is  needed" New topic

The only time a lookup is needed

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 866
On Frits' notes, p.63,

7.1 @EJB - injecting an EJB
The only time a lookup is needed is when the @EJB and @Resource is declared on the bean class.

I believe a lookup is also needed when an EJB is injected, like this example on p.66:

Frits Walraven
Creator of Enthuware JWS+ V6

Joined: Apr 07, 2010
Posts: 1880

What I meant by that remark is that the lookup is not needed in line number 9.

The following code would be sufficient:

Although the code above doesn't look like it has a lookup of the EJB it certainly does a lookup because "Each injection of an object corresponds to a JNDI lookup" (page 63)

jQuery in Action, 2nd edition
subject: The only time a lookup is needed