Mailing List webobjects-dev@wocommunity.org Message #787
From: Ramsey Gurley <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] Optimistic Locking ??
Date: Sat, 24 Oct 2026 19:23:43 -0500
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Hard to say given your description of attr1 and attr2. I'm not sure I understand it clearly.

The way it is supposed to work: Rows are first selected using locked attributes before being updated in the transaction. If both your attr1 and attr2 are locked, then you'd see something like, select ... from table where attr1 = ... and attr2 = ... followed by an update assuming the select returned a row. If any of the locked attributes changed, then the select returns no rows and you get an optimistic locking exception. HOWEVER, keep in mind that EOF also propagates changes to ECs via the notification center. This is so if User 1 edits a row, then the change will show up in a table of data displayed by User 2 on the next page refresh.

Knowing that these two things occur, you can probably deduce what is happening if you play around with Mark Ritchie's freshness explorer application a bit to try to recreate the scenario you are seeing.

On 10/20/26 7:08 AM, Theodore Petrosky wrote:
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>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster