posted 15 years ago
Source: ETS (Enthuware)
Which of the following statements are correct regarding any session bean life cyle?
Answers (Choose 2)
1) The context is injected after the bean is created but before the post construct callback method is invoked on that bean
2) Once removed by a client, a stateless session bean cannot be used again to service requests from other clients.
3) Once removed by a client, a stateful session bean cannot be used again to service requests from other clients.
4) For each dependency injection of a stateless session bean in another component, a new instance of the injected bean is crea
5) A container may or may not remove a stateful session bean instance when a client calls remove().
ETS Answer: 1 & 3.
I agree with that. But i think answer 5 is also correct. Consider the scenario. When a client invokes a remove method, container will not remove the instance if the method throws an application
exception and specifies retainIfException=true. Hence answer 5 cannot be ruled out. Since the option 5 itself uses
words like "may or may not" , It further cements the fact the answer 5 is a correct option.