Mailing List webobjects-dev@wocommunity.org Message #783
From: Maik Musall <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] Optimistic Locking ??
Date: Tue, 20 Oct 2026 14:36:27 +0200
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
Hi Ted,

I don’t think that’s a locking problem. In a use case like this, you already have the database as a safeguard that you could use against what you’re describing.

I have forgotten where this would be done in EOF, but if you can get the WHERE clause to specify ALL attributes of the row in the expected state before change by user 2, that UPDATE will fail if another user already updated one of the attributes of that row to a value that no longer matches there WHERE clause. User 2 (or his session) would then need to refresh it’s cached row from database to see the new-current values and then retry a new update based on that new before-state.

Maik



> Am 20.10.2026 um 14:08 schrieb Theodore Petrosky <webobjects-dev@wocommunity.org>:
>
> I need some help with optimistic locking. Maybe I'm not understanding this correctly.
>
> I have my entities set up in EOModeler with certain attributes marked as locking. Everything functions correctly in the app by the way, this is a D2W modern app.
>
> User number 1 logged in from one location and edits attb1, user 2 logged in from another location and is editing at the same record. User one updates attb1 and saves. By the way I am watching the SQL go by and I see the optimistic locking. I mean, I see update Entity.attr1 where attr2 = “”;
>
> User two login and updates Entity attr2  and saves. SQL  update Entity.attr1 where attr1 = the new attr1. The save goes through wiping out user ones change.
>
> I expected to get a warning saying can't update this record because optimistic log is out. Or, just a failure with a validation error.
>
> Am I doing something wrong or did I not set something in a property?
>
> Ted
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list <webobjects-dev@wocommunity.org>.
> To unsubscribe, E-mail to: <webobjects-dev-off@wocommunity.org>
> To switch to the DIGEST mode, E-mail to <webobjects-dev-digest@wocommunity.org>
> To switch to the INDEX mode, E-mail to <webobjects-dev-index@wocommunity.org>
> Send administrative queries to  <webobjects-dev-request@wocommunity.org>
>

Content Unaltered as verified By:
presented certificate is issued by an unknown authority:Maik Musall <maik@selbstdenker.ag>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster