This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The only time a lookup is needed

 
Himai Minh
Ranch Hand
Posts: 1398
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!