Two Laptop Bag*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ETS Question on session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ETS Question on session bean" Watch "ETS Question on session bean" New topic

ETS Question on session bean

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
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.

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345

Look for the completeness of the sentences. Statement 5 would have been correct if the sentence also said anything about retainIfException attribute of the @Remove annotation.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
I agree. Here's the link:
subject: ETS Question on session bean
Similar Threads
My SCEA Part 1Study Notes
Doubt in SessionBean contract(ejb 3.0 core)
ETS Question doubt 1
Can a stateless session bean be removed by client?
Stateless Sessionbean ejbCreate() mtd