File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Entity Bean Passiavtion? 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 "Entity Bean Passiavtion?" Watch "Entity Bean Passiavtion?" New topic
Author

Entity Bean Passiavtion?

Ali Ragi
Ranch Hand

Joined: Dec 10, 2003
Posts: 60
CAN The container choose to passivate an entity bean instance WITHIN a transaction, or BETWEEN transaction, or BETWEEN METHODS. How the container decide when to passivate?
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
The container will not passivate entity beans or stateful session beans if they are in a transaction. It could passivate an entity bean in between transactions because this is the same as saying, "not in a transaction." It could passivate an entity bean between methods. In this case, when another client goes to use the same entity, the container will just bring another bean out of the pool to represent the entity. Different containers will have different passivation logic. It is not for you, the bean developer to worry about. One reason a container might passivate an entity bean is that it is running low on resources and no one has called a method on the bean in a while.
[ March 01, 2004: Message edited by: Anthony Watson ]

Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Dilli raj
Greenhorn

Joined: Jan 31, 2004
Posts: 24
The container cannot passivate an entity bean instance WITHIN a transaction.
But it can passivate BETWEEN transaction, or BETWEEN METHODS.


SCJP,SCWCD,SCBCD
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
The container will not passivate entity beans ... if they are in a transaction.

I used to think this was true, until I read a surprising passage in the spec [section 10.5.1, pg 169]:

The container can chose to passivate an entity bean within a transaction.

This may seem odd, but when you think about it, this can work for an entity bean. The container can do an ejbStore without doing a commit; the data is just hanging around on the server waiting for the commit at the end of the transaction, so the entity bean instance really isn't needed any longer.


Reid - SCJP2 (April 2002)
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
As Reid said,
SFSB cannot be passivated in a transaction.
Entity beans can be passivated in a transaction by the container.
The concept of passivation is different for SFSB and Entity bean, even though they both share the same name.
Passivation of SFSB deals with the serialization of the bean's data,
while passivation of entity beans deals with the bean being sent back to the pool.
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
If an entity bean is in the middle of a transaction why would the container want to passivate? How would that effect the transaction? I mean we are talking CMT here so it must be in the middle of a method and therefore doing something currently (or uber-badly programmed). It sort of worries me that mid way through changing a field on an entity the container just throws it back to the pool. What happens to the transaction? Does the pooled entity bean retain its lock on the database row?


Morgan
SCJP (1.4), SCJD (1.4), SCWCD (1.3), SCBCD (1.3)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Entity Bean Passiavtion?