There is a way to avoid the container call of ejbStore each time you invoke business method (if the database is rarely updated), it is to use the "isModified" optimization  (see the section "isModified optimization for container managed entity beans" at the end of the BeanProgrammer's Guide at http://www.objectweb.org/jonas/jonas_root/doc/Program.html#Bull).
However, at each transaction boundary, an ejbLoad is necessary (when you start a new transaction, you need to load the data from the db, since it may have been changed in the db by another transaction). Thus in your scenario, at point 5, you start a new transaction, and then, at point 8, at the first business method call, an ejbLoad is necessary.
In you case, you do a transaction for reading the user name,
  • if your intention is to get the last value of this attribute in the database, this is correct and the ejbLoad cannot be avoided ! even if the database is rarely updated.
  • if you do not care to get the very last value of the attribute in the db (since it is rarely updated), then just do your operation outside a transaction (do not start a transaction, put a "Never" , "Supports", or "NotSupported" transactional attribute on getUserName), and set a passivation timeout to 60s if you want your value to be refreshed every minute ...
Best Regards,

François

yahoo wrote:

 Thanks lot françois; is there a way to avoid the container call of ejbLoad eatch time I invoke business method  ? This is My scenario :    0 --> utx.begin()   1 ---->get Home interface   2 ---->findbyPrimaryKey   3 ---->getUserName   4 ----> utx.commit();    5 --> utx.begin()   6 ---->get Home interface   7 ---->findbyPrimaryKey   8 ---->getUserName            <---  is it possible to avoid ejbLoad Call at this point ?   9 ---->utx.commit();  My problem is that the database is rarely updated...   thanks 
----- Original Message -----
To: yahoo
Sent: Friday, July 20, 2001 11:30 AM
Subject: Re: ejbPassivate/ejbActivate frequency call ?
 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
==================================================================
 

--
==================================================================
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