Hi Evan,
I just wanted to say that, after all the conversation about
optimistic/pessimistic locking and concurrency, you have shown the optimal
optimistic solution in fewer than 10 sentences and exactly one line of code.
It's more work for the programmer, but the best result always is.
While this discussion is almost always couched in terms of "with
optimistic locking, the programmer expects relatively few changes to the
data..." the real issue and reason for using optimistic concurrency is to
allow the maximum number of concurrent users while maintaining data
integrity.
Hats off!
Joe Sam
Joe Sam Shirah
Autumn Software - Consulting/Development/Outsourcing
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Qu� Java400? http://www.jguru.com/faq/Java400
----- Original Message -----
From: "Evan Ireland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 06, 2000 3:57 PM
Subject: Re: Comparison of solutions for stale data checking and
shorttransactions
> Sachin Hardas wrote:
> >
> > Kristofer,
> > The solution you suggested would work only if you can modify the
database.
> > We are not so lucky and cannot in any way update the database schema.
>
> Say you have table T, key column K, and data columns X, Y and Z. In your
> entity bean for T, save the original values of X, Y and Z. When you issue
> an update, use SQL of the form:
>
> update T set X = newX, Y = newY, Z = newZ
> where K = theK and X = oldX and Y = oldY and Z = oldZ
>
> Check the row count for this update. If it is zero, then rollback the
> transaction.
>
____________________________________________________________________________
____
>
> Evan Ireland Sybase EAServer Engineering
[EMAIL PROTECTED]
> Wellington, New Zealand +64 4
934-5856
>
>
===========================================================================
> 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".
>
===========================================================================
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".