• 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: Arturo Perez <email@hidden>
  • Date: Tue, 15 Nov 2005 09:23:16 -0500

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.

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


The way I've done it is to put a UNIQUE constraint on the login. Then, when I save changes, I trap the constraint violation if it occurs. There's a thread on this that you might find helpful. Pierre Bernard, Chuck Hill and myself participated in it but I don't remember the name of the thread. It was back in September I think.
_______________________________________________
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: Re: Table locking in WO?
  • Next by Date: Re: empty replay
  • Previous by thread: Re: Table locking in WO?
  • Next by thread: EOGenerator
  • Index(es):
    • Date
    • Thread