Hi,

activation/passivation is related to the transactional behaviour of your application. Let me rephrase an answer of Philippe Durieux on the jonas-users list, explaining the activation/passivation of entity beans in JOnAS (you can also have a look a the end of the Bean Programmer's Guide of the JOnAS documentation, http://www.objectweb.org/jonas/jonas_root/doc/Program.html#Bull, the section about passivation timeout for entity beans):
Passivation/activation of entity beans depends if you use transactions or not. If you do not use transactions (you never start transactions and you have set transactional attributes "Never" , "Supports", or "NotSupported" for all the methods of your beans) then no passivation will occur, except after a timeout (configurable, see the Appendix below). If you use transactions, either explicitly, or implicitly (transactional attribute "Required" for example), then the activation will occur at the beginning of each transaction, and passivation will occur at the end of the transaction if committed.
If you mix transactional request and non transactional requests, each transaction will lead to a passivation of instance used outside transactions before activation (without waiting for the timeout). This because you cannot have at the same time an instance involved both in a request inside a transaction and in a request outside a transaction. Note that when talking about passivation/activation, only the instance state is concerned. A pool of entity bean instances is managed by the container so that only the ejbLoad and ejbStore are called, but not all the loading of your bean.

Hope this will allow you to understand the particular behaviour you observe... if your getUserName method is called within a transaction (e.g. it has a transactional attribute "Required", "RequiresNew", ...) which is commited just after the call, then it is normal that you see a passivation operation.

Best Regards,

François

Appendix : Configuring the passivation timeout
This passivation timeout can be configured in the jonas specific deployment descriptor, with a non mandatory tag <passivation-timeout>.
Example:

    <jonas-entity>
      <ejb-name>Item</ejb-name>
      <passivation-timeout>5</passivation-timeout>
      .....
    </jonas-entity>
 

yahoo wrote:

Hello everybody; I am using the latest JOnAS, and I would like to now when exactly ejbPassivate/ejbActivate are called ? I found out that Jonas execute ejbPassivate just after I finish invoke "getXXX" methods on my Entity Bean: Example :  Entity Bean  "User" Steps:    1 ---->get Home interface   2 ---->findbyPrimaryKey   3 ---->getUserName   4 end I remark that ejbPassivat is executed by Jonas just after getUserName. is it normal ? thanks lot...
--
==================================================================
François EXERTIER         Evidian (Groupe Bull)
     1, rue de Provence,  BP 208,  38432 Echirolles cedex, FRANCE
     mailto:[EMAIL PROTECTED]
     http://www.evidian.com/jonas   http://www.objectweb.org/jonas
     Tel: +33 (0)4 76 29 71 51  -  Fax:   +33 (0)4 76 29 77 30
==================================================================
  ---- This list is cross-posted to two mail lists. To unsubscribe, follow the instructions below for the list you subscribed to. For objectweb.org: send email to [EMAIL PROTECTED] and include in the body of the message "unsubscribe ejb-container-group". For enhydra.org: send email to [EMAIL PROTECTED] and include in the body of the message "unsubscribe ejb-container-group".

Reply via email to