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

Re: Table locking in WO?


  • Subject: Re: Table locking in WO?
  • From: Ken Anderson <email@hidden>
  • Date: Tue, 15 Nov 2005 07:36:24 -0500

An approach I like to take in these situations is to have another application that is responsible for user creation. Both apps would message this UserManager WOApp (via web services is one way) and it would either return a global ID or an error. The app would keep a running list of all users so that duplication is not possible.


On Nov 15, 2005, at 6:14 AM, Miguel Arroz wrote:

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:
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: 
 >Table locking in WO? (From: Miguel Arroz <email@hidden>)

  • Prev by Date: Table locking in WO?
  • Next by Date: Re: Table locking in WO?
  • Previous by thread: Table locking in WO?
  • Next by thread: Re: Table locking in WO?
  • Index(es):
    • Date
    • Thread