Hi Armin,

We thought this could be becoz of broker cache. So we did some more testing
as follows:

1. Close the broker in method A after the call to method B.
2. Obtain a new broker in method A after the call to method B. Use this
broker to find the updated values.

Even after doing this, sometimes we get STALE data.

The behaviour is unpredictable. Sometimes we get the updated value and some
times we get the old values.

This behaviour happens when there are concurrent users doing the same
transaction. This we have reporduced using "Grinder" load testing tool. To
handle the concurrent users, we have put the static SYNCHRONIZE block inside
method B.

Even after doing this, we get STALE data from the new broker.

If i bypass OJB, that is, if i do a direct JDBC call then i get the updated
values always.

Any thoughts on this.

Regards,
Sriki

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 21, 2005 6:42 PM
To: OJB Users List
Subject: Re: JTA transaction with PB API


Hi Sirki,

 > I am under the assumption that once method B is completed, the data
should
 > be committed to the database.
 >
 > Is my assumption true?

yep, I suppose so.


 > If so, then what could be the problem??

think the problem is the per broker cache. When bean B is used the
running tx of bean A will be suspended and a new tx for bean B starts.
Bean B lookup a PB instance and OJB return a new PB instance, because
now we use a different tx, so OJB can't reuse the PB instance from Bean
A. If the object updated in Bean B was used in A too, then in the
broker-cache of the PB instance used in bean A the outdated object will
still be remain.

Did you try to running your test without an cache?

regards,
Armin

Srikanth R wrote:
> Hi,
>
> I am using OJB 1.0.0 in Jboss [3.2.5] environment. The
> PersistenceBrokerFactoryClass used is "PersistenceBrokerFactorySyncImpl".
We
> are using PB API and per broker cache.
>
> I am having problem with the PB / JTA transactions. Below is the scenario:
>
> I have two session beans. First session bean's method A is calling second
> session bean's method B. The "trans-attribute" of method A is "Required"
and
> that of method B is "RequiresNew".
>
> The method B updates a record in the database. This updated record is
> fetched from database in method A after the call to method B.
>
> But when we retrieve this record, we are getting the old values and not
the
> updated values.
>
> I am under the assumption that once method B is completed, the data should
> be committed to the database.
>
> Is my assumption true? If so, then what could be the problem??
>
> Thanks,
> Sriki
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to