This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Stateful session bean passivation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Stateful session bean passivation" Watch "Stateful session bean passivation" New topic

Stateful session bean passivation

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
EJB 3.0 Core Specification:A container may only passivate a stateful session bean instance when the instance is not in a transaction.
I was thinking how and when such a scenario come up. After thinking for a while the following struck me.

a) Client starts a transaction using UserTransaction JNDI lookup.
b) Client invokes business methods on the session bean via session beans business interface.

Client remains idle long enough so that container can decide to passivate the sesion bean instance servicing the client.But before transfering the converstaional state to secondary storage, container realizes that this instance is in the middle of a transaction and hence will not passivate the instance.
EJB Version : 3.0
Application Server: JBOSS 4.2.3.GA
J2SE: 1.5 or 5.0
OS: Windows XP

a) Is my understanding correct? Are there any other scenarios ?
b) The container came to knew that the instance is middle of the transaction because the client requested the transaction from the transaction service provided by the container. Is this correct?
c) Why does not the container passivate the instance if its in the middle of a transaction. What is the problem?

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Experts, Please take time and reply.
I agree. Here's the link:
subject: Stateful session bean passivation
It's not a secret anymore!