• 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: Avoiding duplicate records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding duplicate records


  • Subject: Re: Avoiding duplicate records
  • From: Mike Schrag <email@hidden>
  • Date: Wed, 16 Jan 2008 08:41:11 -0500

I have the same situation in my database: Java checks to see weither the
email address is already in use; if it is, the user gets a message: "Sorry;
this email address is already in use in our database ... please try again."
Up to the user then.
... until you have two instances, and two users that insert at about the same time (actually this doesn't even require two instances, necessarily -- you would have a race condition even with concurrent requests enabled). Unlikely, yes, but it's the unlikely problems that the term "famous last words" came from. Constraints defined in Java sounds great, and I prefer it aesthetically, but reality LOVES to screw aesthetics. The database is the only place where you will get atomic enforcement of data constraints such that you can guarantee you will not get violations. My typical approach is to implement what you are saying here PLUS define a unique constraint on the database. So 99.9% of the time, it is handled by Java, but the 0.1% that nature decides you deserve it, you don't end up with a terrible data problem on your hands.

ms

_______________________________________________
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: 
 >Re: Avoiding duplicate records (From: "WILLIAM GARNETT" <email@hidden>)

  • Prev by Date: Re: How to avoid wrong mapping after new object inserted
  • Next by Date: Re: How to avoid wrong mapping after new object inserted
  • Previous by thread: Re: Avoiding duplicate records
  • Next by thread: excludeObjectFromPropertyWithKey failed faulting...
  • Index(es):
    • Date
    • Thread