Hunsberger, Peter wrote:
In general, this moves the responsibility for locking up a level which
isn't something I'd care to code, but if you're going to use JDO I
believe you'll just get a last change wins result anyways, which is how
you could manage this...

If you implement this strategy, pretty soon you're going to end up with lost updates: Bob reads a record, Alice reads the same record, makes some changes and commits them, Bob makes some changes and commits them, overriding all of Alice's changes.


To solve this problem, you need to implement an optimistic locking strategy using version fields. Bob would not be able to commit his changes because the version number he retrieved does not match the one stored in the database because Alice incremented it.

I know Hibernate handles this, don't know about JDO.

Ugo


-- Ugo Cei - Consorzio di Bioingegneria e Informatica Medica P.le Volontari del Sangue, 2 - 27100 Pavia - Italy Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]



Reply via email to