Exforsys.com
 

Sponsored Links

 

SCBCD Tutorials

 
Home Certification SCBCD
 

SCBCD Study Notes : Chapter 3 : Session Bean Component Contract (Part 1)

 

SCBCD Study Notes : Chapter 3 : Session Bean Component Contract (Part 1) - Page 2

Page 2 of 3



Identify the use and the behavior of the ejbPassivate method in a session bean, including the responsibilities of both the container and the bean provider.


Bean Provider's responsibility


Passivation is performed only for STATEFUL session beans. The Bean Provider is required to ensure that the ejbPassivate method leaves the instance fields ready to be serialized by the Container. The objects that are assigned to the instance’s non-transient fields after the ejbPassivate method completes must be one of the following:


  • A serializable object.
    .
  • A null.
    .
  • An enterprise bean’s remote interface reference.
    .
  • An enterprise bean’s remote home interface reference.
    .
  • An entity bean’s local interface reference.
    .
  • An entity bean’s local home interface reference.
    .
  • A reference to the SessionContext object.
    .
  • A reference to the environment naming context (java:comp/env JNDI)
    .
  • A reference to the UserTransaction interface.
    .
  • A reference to a resource manager connection factory.
    .
  • An object that is not directly serializable, because it contains references on "non-serializable" objects mentioned above.

Bean Provider must close all JDBC™ connections in ejbPassivate and assign the instance’s fields storing the connections to null.


The Bean Provider must assume that the content of transient fields MAY be lost between the ejbPassivate and ejbActivate notifications.


Container's responsibility


The container performs the Java programming language Serialization (or its equivalent) of the instance’s state after it invokes the ejbPassivate method on the instance.


The container must be able to properly save and restore the reference to the home and component interfaces of the enterprise beans stored in the instance’s state even if the classes that implement the object references are not serializable.


If the session bean instance stores in its conversational state an object reference to the javax.ejb.SessionContext interface, java:comp/env JNDI context or UserTransaction interface, the container must be able to save and restore the object reference across the instance’s passivation.


The container may destroy a session bean instance if the instance does not meet the requirements for serialization after ejbPassivate.


While the container is not required to use the Serialization protocol for the Java programming language to store the state of a passivated session instance, it must achieve the equivalent result. The one exception is that containers are NOT REQUIRED to reset the value of transient fields during activation (as opposed to pure Serialization, which GUARANTEES that transient variables will come back with default values for that type).


Passivation typically happens spontaneously based on the needs of the container. It happens just BEFORE writing state to secondary storage.


Activation typically occurs when a client calls a method. It happens just AFTER reading state from secondary storage.




Next Page: SCBCD Study Notes : Chapter 3 : Session Bean Component Contract (Part 1) - Page 3


Read Next: SCBCD Study Notes : Chapter 3 : Session Bean Component Contract (Part 2)



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape