I'm confused.

You're creating the cartservice object in the application scope (a scope 
shared by *ALL* visitors to your web site) *AND* initializing it with an 
ID SPECIFIC to the current shopper.

Question #1 - Why are you using the application scope for session 
specific information?  I can't even imagine how that would work at 
all... I'm sure it does... but..

Question #2 - why not use CreateUUID() instead of attempting to generate 
a unique ID?  Your method doesn't guarantee uniqueness because two 
shoppers may be created in the same second.  RandRange() doesn't 
guarantee uniqueness either, but createUUID() does.

If you must insist on basing your shopper ID on the time, you could try 
using Now().getTime() which actually returns a very long integer 
containing the number of milliseconds since the java epoch (like january 
1, 1970 or something).  It's allegedly precise to the millisecond, but 
still not a guarantee.

Question #3 - Why don't you just put a unique key on the column in the 
database table.  That would guarantee uniqueness upon insertion into the 
database.  It doesn't have to be the primary key, but you can still put 
a unique index on it.

Rick

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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

Reply via email to