geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Geronimo 2.0.2 - OpenEJB "Passivation Failed"
Date Tue, 11 Mar 2008 18:22:15 GMT

On Mar 10, 2008, at 4:38 AM, the666pack wrote:

> David Blevins wrote:
>> You could implement serializable on your Entity beans, but it's ill
>> advised in almost any situation to have the data passivated with your
>> bean as you wind up with a private, detached, copy of the data that
>> may be outdated.  The rare case may be that you're collecting data
>> that has yet to be persisted (never been attached) and therefore
>> doesn't live in the EntityManager's cache or database yet, but even
>> then you should really be using a transaction which would prevent  
>> your
>> bean from getting passivated at all so the issue should never arise.
> so this means i have to manually "turn off" the passivation of my  
> SFSB via
> bean managed transactions. but i suppose this means a performance  
> loss :(.

A container or bean managed transaction will work, though a bean  
managed may be easier for long running transactions.

> is this problem another issue of the bug mentioned above and so the  
> only
> solution is turning off the passivation mechanism?

No, this is just a warning to be careful of *potential* complications  
serializing (which is storing) database data somewhere that is not the  
database for future use.  It is fine to do in the right  
circumstances.  Just wanted you to be aware there is an actively  
maintained cache of entities in the EntityManager itself which never  
leaves memory.  In terms of temporary storage, it's usually the far  
better place than a serialized stateful bean.

Also know that it is possible to implement serialization api methods  
in your stateful bean such as writeObject and readObject which gives  
you more control of what and how your bean is serialized/ 
deserialized.  It is possible to do things like write the primary key  
data of the entities you're holding during serialization, then in  
deserialization use the EntityManager and primary keys to grab the  
live entities again.

> further, til now whenever i tried to make some kind of manual  
> transaction in
> my beans i always got the error that the container is taking care of  
> the
> transactions and bean managed control (transactions) is not allowed.  
> maybe
> you can tell me what i have to change to be able to add transactions  
> to my
> bean.

You just have to add this to your bean:


The default is TransactionManagementType.CONTAINER as you've noticed.

Just another FYI on a good reference, here's a full list javax.ejb and  
javax.annotation annotations and their defaults when unspecified:

> and even further, is there the possibility to turn off the  
> passivation for
> SFSB at all in geronimo? like some entry in a deployment descriptor
> "passivation=false" ?

Nothing like that.  Best you can do is bump your poolSize up much  
higher.  The settings we supply are very conservative and you could  
likely have a much higher limit depending on the memory limits of your  


View raw message