Dan,

We only create the requisition number prior or to the actual order placement
in very specific circumstances and store it in a structure in the session
scope, but those numbers are not being duplicated due to the very nature of
the hows and whys.  Only the numbers generated at the time of the order are
having this issue.

I see what you are saying about the multiple submits, but the exclusive
named lock should be preventing the code that is generating the number from
running more than once in the application at any given time.  This should
end up creating duplicate orders, but not duplicate request numbers.

The generation of the number is where we are getting our duplicate values,
but the logic around the generation of the number is fairly simple: 

Query the database for the next value
Add a prefix or suffix and formatting depending on customer preference
Increment and update the value in the database

There are two clients that are generating part of the number in a Julian
date format where we have done some manipulation to handle duplicate
numbers.  This is, however, happening across multiple higher volume clients.
The simple read, increment, update clients are producing duplicate numbers
from within a named exclusive lock inside a serialized transaction.

I replied to an earlier request to include the lock/transaction block.  All
of this takes place within that block.

Dave
> -----Original Message-----
> From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 18, 2007 8:20 AM
> To: CF-Talk
> Subject: RE: Exclusive locks still producing duplicate values
> 
> Dave,
> 
> Also, if you're generating this "Request" number on a page 
> before you actually submit to database, then a user clicking 
> the submit multiple times would generate duplicate records 
> with the same request number.
> 
> Example: on Page A you generate the request number so you can 
> display it to the user. Page A allows the user to confirm the 
> creation process. When the user clicks the "submit" button, 
> it goes to Page B which actually inserts the data into the 
> database. If the user clicks the "submit" button multiple 
> times it can create multiple requests.
> 
> Are you ever storing this request number in any scope 
> (Session, Form, Url,
> etc?)
> 
> Also, are you absolutely positive your code is returning 
> unique numbers?
> You're locking may be working, but if there's an error in the 
> logic you could still produce duplicate request numbers.
> 
> For example, let's say you were creating a number based upon 
> the current date time stamp:
> 
> <cfset dtNow = dateFormat(now(), "yyyymmdd") & 
> timeFormat(now(), "HHmmss") />
> 
> <cflock>
>   <!--// insert unique number //-->
> </cflock>
> 
> By creating the dtNow number outside of the lock, I'm opening 
> myself up to duplicate values. 
> 
> This is just an example...
> 
> -Dan
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295009
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to