• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Entity Bean Passiavtion?

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container cannot passivate an entity bean instance WITHIN a transaction.
But it can passivate BETWEEN transaction, or BETWEEN METHODS.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic