Re: Avoiding duplicate records
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