• 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
Table locking in WO?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Table locking in WO?


  • Subject: Table locking in WO?
  • From: Miguel Arroz <email@hidden>
  • Date: Tue, 15 Nov 2005 11:14:14 +0000

Hi!

I was wondering how to do something like this... imagine a form to create a new user on a site. The code would be something like:

EOFetchSpecification fetchSpecificationForUserWithLoginArroz = blah blah blah; // line 1

NSArray objects = someContext.objectsWithFetchSpecification (fetchSpecificationForUserWithLoginArroz); // line 2

  if( objects.count() == 0 ) { // line 3
    /* create user with login arroz */
  }

The problem is... what happens if two or more instances of the application run this code at the same time? Specifically, if two instances run both line one and line two at the exactly same time, when running line 3, one of them will create a second user with the same login.

Of course, one way of avoiding this is to make the login the primary key... but I don't like this method at all. The other way I see is using table locking. How to do that in WebObjects? I assume it's not easy, as I shouldn't even know there is something called "table" at this level...

  How do you take care os this problem on your apps?

  Yours

Miguel Arroz

      "I felt like putting a bullet between
       the eyes of every Panda that wouldn't
       scr*w to save its species."       -- Fight Club

Miguel Arroz
http://www.ipragma.com



_______________________________________________
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


  • Follow-Ups:
    • Re: Table locking in WO?
      • From: Arturo Perez <email@hidden>
    • Re: Table locking in WO?
      • From: Ken Anderson <email@hidden>
  • Prev by Date: empty replay
  • Next by Date: Re: Table locking in WO?
  • Previous by thread: Re: empty replay
  • Next by thread: Re: Table locking in WO?
  • Index(es):
    • Date
    • Thread