• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Environment entry lookup

 
Sylvain Bouchard
Ranch Hand
Posts: 41
Java ME Objective C Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

I've just finished to read HeadFirst EJB...

And I have a question about the last coffee cram
exam [p.628 question #4].

My answer was B, C, but I don't understand why B is wrong.

Question is:

Given a bean named "Customer", and an environment entry named "lastName",
which code fragment(s) inside of the bean class would return the value
of the environment entry?

Answer B is:


Thanks

Sylvain
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just the wrong way to look up an environment entry. The name of the bean is unnecessary. You can only access the special java:/comp/env from within the bean code and the bean code already knows what kind of bean it is. There's a different environment for each bean type, and each one can only access its own. C is wrong because there's no such thing as a Lookup class. The correct answer is E.
 
Sylvain Bouchard
Ranch Hand
Posts: 41
Java ME Objective C Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Greg.

I thought that was a subcontext. But in reality, it's the bean !!

Sylvain
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic