aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Conversational state and Passivation and Open Resources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Conversational state and Passivation and Open Resources" Watch "Conversational state and Passivation and Open Resources" New topic
Author

Conversational state and Passivation and Open Resources

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
EJB 3.0 Core Specification: During passivation, if the stateful session bean's conversational state has references to open resources like open sockets and open database sockets then its the responsibilty of bean provider to restore such references because they will be lost during passivation. But they are exceptions to references to EntityManager and EntityManager factory. This is because the container will restore these references on behalf of bean provider because they are part of java persitence API framework which is one of the services provided by the container to session beans.

Is this understanding correct.

Based on this understanding can i say that if I have a java.sql.Connection reference to a database [Resource], I will have to explicitly close the connection before passivation and open a new connection to the data source after activation.Container allows be to do so in the PostActivate and PrePassivate lifecycle callbacks. So was this the very reason the container
decided to notify the session bean of these events, so that session bean can restore the part of the converstaion state that is not saved by the container during passivation.
****************************************
---------------
Environment
---------------
EJB Version : 3.0
Application Server: JBOSS 4.2.3.GA
J2SE: 1.5 or 5.0
OS: Windows XP
****************************************


SCJP, SCWCD, SCBCD
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Experts, Please take time and reply.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Conversational state and Passivation and Open Resources
 
Similar Threads
Good practice ?
EJB Spec Section 4.2.1 doubt
if variables not set to null before passivation?
conversational state of SFSB
My SCEA Part 1Study Notes