Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam Question(Repost)

 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following statements regarding an enterprise bean's environment are correct?


1. The container provides the tools that allow the deployer to create and manage the enterprise bean's environment.
2. Enterprise bean instances can modify the values of the environment entries at runtime.
3. The deployer sets and modifies the values of the environment entries by editing the enterprise bean's deployment descriptor.
4. Enterprise bean instances obtain the values of the environment entries from the enterprise bean's deployment descriptor.
5. Enterprise bean instances use the JNDI interfaces to obtain the values of the environment entries.
Answers 1 and 5 are correct.
Answer 2 is incorrect because enterprise bean instances can only read the values of the environment entries at runtime and are not able to modify them. Answers 3 and 4 are incorrect because the deployment descriptor is used to define only the environment entries, as opposed to the values that the enterprise bean expects to be provided at runtime.

Can someone explain a bit in detail why 3 and 4 are wrong?...as far as i remember we specify even the values in Deployment Descriptor ...please have a look EJB specs - page 410 section 20.2 before answering
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

About answer 4, the bean doesn't get its env. values from the DD, but from its environment (JNDI). DD is used to create this environment.

But for point 3, I am surprised. The deployer has the right to set/modify values like this. May be the idea is that he uses the container tools, but this is not mandatory.

May I ask where you found this question?
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding of the spec 410 section 20.2

2. The Container provides an implementation of the JNDI naming context that stores the enterprise bean environment. The Container also provides the tools that allow the Deployer to create and manage the environment of each enterprise bean.

That's why 1 is correct.

3. The Deployer uses the tools provided by the Container to create the environment entries that are declared in the enterprise bean�s deployment descriptor. The Deployer can set and modify the values of the environment entries.

That's why 3 is incorrect - should use tools.

4. The Container makes the environment naming context available to the enterprise bean instances at runtime. The enterprise bean�s instances use the JNDI interfaces to obtain the values of the environment entries.

That's why 5 is correct and 4 is incorrect.

Each enterprise bean defines its own set of environment entries. All instances of an enterprise bean within the same home share the same environment entries; the environment entries are not shared with other enterprise beans. Enterprise bean instances are not allowed to modify the bean�s environment at runtime.

That's why 2 is incorrect.
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDiscuss..
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys ..that does make sense..but its like they are trying to get a bit too deep into the skin for comfort
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its like they are trying to get a bit too deep into the skin for comfort


Hoping these kind of questions won't appear in the real exam.
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes...but at the end..all we can do is hope..for hope
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic