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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/lists% 40anderhome.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to