• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Optimistic Locking Example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimistic Locking Example


  • Subject: Re: Optimistic Locking Example
  • From: Ken Anderson <email@hidden>
  • Date: Mon, 23 May 2005 08:13:59 -0400

Dimitri,

Kieran gives a lot of good reading examples, but I'll tell you what I think is happening:

When the first user commits their changes, the snapshot (what EOF uses to know what was fetched from the database regardless of your changes) is updated to reflect the newly saved changes.

At this point, the EO that is in the second user's session gets its values updated, because it isn't dirty yet (this is done through a notification system that keeps objects in sync if they're changed). It isn't dirty yet because, since you're using the web, it has no idea that you changed the fields on the web browser (since you haven't posted that change yet).

So, after the first user commits, all the copies of the object are updated to the first user's changes. Now, when you hit 'save' for the second user, it happily modifies the current version of the object, and successfully saves.

Ken

On May 23, 2005, at 7:44 AM, Dmitri wrote:

Hi every1,

i wanted to ask if some could send me small example programm for optimistic locking. I mean i tryed to write one now. Just made simple WOApplciation "Test".
Than added to this e Emodel like "test".


Now i had Applicatin Test.woa qwith nice model in it "test.eomodeld" with only one Table "Test", with 3 attributes. testid (PrimaryKey Locked), testfield1(Integer, Locked), testfield2 (String Locked).

Now if i try to get on this applicatipn from 2 differend Browsers and editing same object there. Like User1 takes this object to edit, Than user2 takers this object to edit. User2 saves Changes. User1 saves changes. here must be actually exeption from Optimist locking, that object was already saved and have changed his values, but nothing happens. values just overwrite last saved data in databse. Do i understand it right, that my Optimistic Lockign thing is not working ?

So if some1 could write small application with using and actually getting exception on saving from two different instances, i would very appreciate this.

Dmitri
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden


_______________________________________________ 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
References: 
 >Optimistic Locking Example (From: Dmitri <email@hidden>)

  • Prev by Date: Re: Optimistic Locking Example
  • Next by Date: Re: Packaging webobjects apps and frameworks
  • Previous by thread: Re: Optimistic Locking Example
  • Next by thread: Re: Optimistic Locking Example
  • Index(es):
    • Date
    • Thread