Ed,

If you use the highest synchronization level (Serializable), then component
A locks the record when it reads it. Therefore component B can't read the
record from the database until A has completed its transaction and released
the lock.

Anne

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 04, 1999 5:47 PM
Subject: Lost Updates and EJB


Hi all,

     I've been dusting off my old database book recently, and I've run into
an
interesting problem in transactions -- the Lost Update.  A lost update
occurs in
a scenario such as the following.  Assume two components A and B
concurrently
perform these operations:

1 Component A reads integer X from the database.  The database now contains
X =
0.
2 Component B reads integer X from the database.  The database now contains
X =
0.
3 Component A adds 10 to its copy of X, and persists it to the database.
The
database now contains X = 10.
4 Component B adds 10 to its copy of X, and persists it to the database.
The
database now contains X = 10.

Thus Component A's update has been lost.

Can someone reason to me which EJB transaction isolation level(s) explicitly
protect against Lost Updates, and how it protects against them?

Thanks
-Ed

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