This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Life Cycle Method True / False 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 "Life Cycle Method True / False" Watch "Life Cycle Method True / False" New topic
Author

Life Cycle Method True / False

Amirr Rafique
Ranch Hand

Joined: Nov 14, 2005
Posts: 324
True / False

The life-cycle method PostConstruct, PreDestroy, PostActivation and PrePassivation are called only once for a Stateful Session Bean.

Please suggest


"Know where to find the solution and how to use it - that's the secret of success."
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi

I think that the PostActivation and PrePassivation can occur more than once, if you deal with an application server.

regards,
Mihai


SCJP, SCJD, SCWCD, OCPJBCD
Amirr Rafique
Ranch Hand

Joined: Nov 14, 2005
Posts: 324
Thanks Mihai
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Just to be more clear, the PostConstruct and PreDestroy are called per "instance" of the stateful session bean.


[My Blog] [JavaRanch Journal]
Krzysztof Koziol
Ranch Hand

Joined: Nov 19, 2006
Posts: 133

Right.
Moreover the PrePassivation method is called each time when a statefull bean instance is passivated (serialized to temporary storage) and the PostActivate is called when the bean is activated (deserialized to bean instance).


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCEA/OCMJEA 5.0
 
 
subject: Life Cycle Method True / False
 
Similar Threads
From HFJS, coffee cram, some options
afterCompletion Problem
why lifecycle method required ?
life cycle in different scopes
if (false == true) Universe.end(42);