Sven Buth wrote:
>Hi,

>I am using JOnAS 1.4.1 with JDK 1.2.1 on a WindowsNT machine.
>I developed some container managed entity beans and have serious
>problems with the synchronization of of the CMP fields. Sometimes after
>a business method has finished the state is stored to the database
>(ejbStore is called) and sometimes the state is _loaded_ (ejbLoad is
>called) immediately after the method has finished. So the changes made
>in the business method are overwritten.
>Is this a bug or what is the reason for this behaviour? Any guess?

>Hi again,
>
>I just tried to change the transaction attribute of the entity bean fom
>TX_REQUIRED to TX_NOT_SUPPORTED. And behold! Now it works. But I
>absolutely do not understand why. Can anyone eyplain this to me?


> 
> Hi,
> 
> I'm using Oracle7.3. But anywhere why should this behaviour been caused by the
> database?
> 
> The DD:
> 
> EntityDescriptor {
>      BeanHomeName             = "ISomePersistentNodeHome";
>      EnterpriseBeanClassName  =
> some.implementations.persistence.SomePersistentNodeBean;
>      HomeInterfaceClassName   =
> some.interfaces.persistence.ISomePersistentNodeHome;
>      RemoteInterfaceClassName =
> some.interfaces.persistence.ISomePersistentNodeRemote;
>      PrimaryKeyClassName      = some.implementations.persistence.SomePrimaryKey;
> 
>      ControlDescriptors       = {
>           { TransactionAttribute = TX_REQUIRED;};
>      };
>      EnvironmentProperties    = "ISomePersistentNodeRemote.properties";
>      ContainerManagedFields   = {
>           fID; fName; fBinary;
>      };
> }
> 
> The bean method:
> 
> public  void addChildToParent( ISomePersistentRemote possibleChild,
> ISomePersistentNodeRemote parent ) throws RemoteException
>      {
>           checkForBadAddition(possibleChild, parent);  <- this one does only
> some checks but does not change anything nor throws any exception
>           parent.addChild(possibleChild);                       <- this one does
>  some changes on another bean
>           setParent( parent );                                         <- this
> one chnages an attribut of this bean
>           parent().publish(); // parent changed    <- this one again does some
> changes on another bean
>      }
> 
> Bye Sven

Hi,

You have to know that the JOnAS container load the data (for a Bean) 
from the database before the beginning of the first method inside a
transaction, then ejbLoad
is called. The container call ejbStore and then write back to the
database the state of the bean at the completion of the transaction.

If a method is called outside the scope of a transaction(it is the case
with TX_NOT_SUPPORTED), the container will call ejbLoad before running
the method and ejbStore at the end.
You can find a description of this behavior and of the isModified
optimization
in a precedent Mail I wrote in jonas-users (subject: Container Managed
Persistence,
Date Fri, 06 Aug 1999 ).
Have a look at the JOnAS Bean Programmer's guide (5. Transactional
Behaviour)
to have a complete explanation of the transactional attributes.

For the moment we have no problem with synchronization of the state of a
CMP Bean
but if you are suspecting JOnAS please send more information like the
code of your Bean.
Regards,
-- 
        Philippe

Philippe Coq  Groupe Bulll/BullSoft/OpenMaster  Phone: (33) 04 76 29 78
49
Bull S.A  - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED]  http://www-frec.bull.com
Download our EJBServer at http://www.bullsoft.com/ejb

Reply via email to