Re: Optimistic Locking?
Re: Optimistic Locking?
- Subject: Re: Optimistic Locking?
- From: Andrew Lindesay <email@hidden>
- Date: Mon, 21 Sep 2009 20:19:48 +1200
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?
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden