Be careful if you use multiple OSCs and OSC Synchrnoization (Wonder
ERJGroupsSynchronizer for example). In that event you must lock the
stack during your (short) transaction in which you check for
optimistic lock exception as part of business logic.
For conceptual and optimistic locking discussion, see this thread by
Miguel Arroz (Dr. Survs ;-) )
http://terminalapp.net/dr-optimistic-locking/
BTW, you can create an OptimisticLockAction class to simplify the
code. For inspiration see ERXEOAccessUtilities.ChannelAction.
HTH, Kieran
On Sep 21, 2009, at 4:19 AM, Andrew Lindesay wrote:
Hi Chan;
In general, optimistic locking will put an extra helping of WHERE
clause at the end of your UPDATE statements. The extra WHERE clause
is to check that nothing has changed in the database row since the
enterprise-object was fetched from the database -- ie; check to make
sure nobody else has fiddled the row. So if the row from table FOO
was fetched with { A=2, B=20 } then a possible UPDATE statement
(with optimistic locking "A" and "B") would be;
UPDATE FOO SET A=123 WHERE A=2 AND B=20
To see this, turn on SQL logging in your WebObjects application.
cheers.
How do I tell if Optimistic Locking is working?
I've made a EOF Model with a versions field. Everything but the id
and the versions field has the lock symbol unchecked in WoLIPS. In
my EOEditingContext delegate's editingContextWillSaveChanges method
I incremented the versions field by 1. I opened up a web page that
edits the EOF model, then used another app to change the versions
number in the database. I made some changes to the EOF model via
the web page and did a save. I don't get an error.
Is there something I need to turn on? A flag of some sort? Or am I
misunderstanding how Optimistic Locking works?
___
Andrew Lindesay
www.lindesay.co.nz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
This email sent to kieran_li...@mac.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com