If the data has been taken to the client, then you are outside EJB, and the
problem becomes the 'well known' one of Client data caching - and I, too
would use (have used/will use until someone solves this structurally) a
Timestamp approach.
This is a deep problem, and there are a range of solutions (of increasing
complexity) depending on the granularity of the changes you wish to allow.
I would be very interested to know if there are simple(ish) solutions being
used 'out there' (Pattern here I think).

Problem : In order to avoid long duration transactions, data is transferred
from the central store to a client. The client operates on the data and then
wishes to save the changes back to the central store. How can we ensure that
the changes do not conflict with changes another client may have made in the
meantime?

The basic solution I use, with different flavours is :
1) The data contains a timestamp. On attempted update, the timestamp is also
returned (unchanged) and compared with the current version using a read with
lock. If the timestamp is unchanged, the updates are applied - otherwise the
lock is removed and the client is informed that their data is 'stale'.
Various recovery mechanisms can then be applied after refreshing the data
from the central store.

Another approach is to disallow other clients to get the data - a variant of
a read with lock, but outside a transaction - by setting a flag in the
central data. This is error prone and restrictive - but can be applied in
controlled circumstances.

Better solutions are welcome - and I _do_ think that a structural solution
at the EJB level would be worth it's weight in coding gold.

My 2p

tim

> -----Original Message-----
> From: Andrzej Kobus [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, May 11, 2000 3:15 PM
> To:   [EMAIL PROTECTED]
> Subject:      FW: How to detect if a synchronization has taken place
> because th e data has changed?
>
> Please, read the original message carefully. You are not within a
> transaction. Transaction Isolation Level should not have anything to do
> with this problem. I know how I would solve this problem outside EJB. I
> would use a time stamp for example. Again, we are talking about detecting
> if the data has changed after first transaction completed and the second
> began. In between a few other transactions could have gone in and changed
> the data.
>
> ------------------------------
>
> Date:    Thu, 11 May 2000 09:44:35 +0530
> From:    Jayant Gupta <[EMAIL PROTECTED]>
> Subject: FW: How to detect if a synchronization has taken place because th
> e
>          data has changed?
>
> Hi
>
> PL read isolation levels for CMP. It all depends upon the isolation level
> you set
>
> Thanks
> Jayant
>
> > -----Original Message-----
> > From: Andrzej Kobus [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 10, 2000 9:09 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      How to detect if a synchronization has taken place because
>
> > the data has changed?
> >
> > Hi Guys,
> >     I have the following question. Is it possible to determine if my CMP
>
> > Entity EJB's values changed between two of my calls? Assume I hold the
> > reference to a remote interface during the whole period of time. Say, I
> > retrieved data from EJB and sent it to a user. This is one transaction.
> > Then
> > two minutes later I want to update the EJB with one new value. This is
> my
> > second transaction. But, I'm not sure that I will not be overwriting
> > somebody's changes made to the EJB between two of my transactions.
> > I could not find any information about this kind of support anywhere in
> > the
> > specs.
> >     With respect and thanking in advance, Andrzej Kobus
> >
> > ________________________________________________________________________
>
> > Get Your Private, Free E-mail from MSN Hotmail at
> <http://www.hotmail.com>
> >
> >
> ==========================================================================
>
> > =
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
> ------------------------------
>
> Date:    Thu, 11 May 2000 11:20:40 -0500
> From:    Vishwa <[EMAIL PROTECTED]>
> Subject: Compilation problem.
>
> Hello all,
>
> I am new to EJB. I am using Sun's J2ee implementation server, while
> trying to deploy an entitiy bean, i am getting this following error.
>
> java.rmo.ServerException : RemoteException occurred in server thread;
> nested exception is:
> java.rmi.RemoteException : Error processing ejb jar: Compilation failed
>
> The server is able to deploy the bean, but while generating the wrapper
> code it throws this RemoteException.
>
> help needed to solve this problem.
>
> tia,
> vishwa
>
> ------------------------------
>
> End of EJB-INTEREST Digest - 9 May 2000 to 10 May 2000 (#2000-62)
> *****************************************************************
>

This e-mail, and any attachment, is confidential. If you have received it in error, 
please delete it from your system, do not use or disclose the information in any way, 
and notify me immediately. The contents of this message may contain personal views 
which are not the views of the BBC, unless specifically stated.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to