Forums Register Login

Environment entry lookup

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks Greg.

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

Sylvain
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 518 times.
Similar Threads
Mock exam question about Context and environment entry
287 Pre-assessment test questions - Please answer
Can i access Local SLSB from jsp?
Could not resolve a persistence unit corresponding to the persistence-context-ref-name
Problem with Synchronized method using RMI
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:04:06.