Re: Globally Unique IDs
Re: Globally Unique IDs
- Subject: Re: Globally Unique IDs
- From: Art Isbell <email@hidden>
- Date: Tue, 24 Jun 2003 16:04:49 -1000
On Tuesday, June 24, 2003, at 03:31 PM, Goodbye Bill wrote:
How can I create a globally unique ID using Java and/or WebObjects? I
am
having to port a .NET / SQL 2000 application to WebObjects and need to
ensure that an ID is never duplicated for several million records in a
database. I also cannot depend on the database to generate the ID.
By default, WO creates a sequence table in the database to store
primary key values (large integers) for each table. Each time a new
object is inserted, the sequence is incremented. Because the fetch and
incrementation occurs on the DB, it can be protected so that not more
than one request for the next primary key can occur before the
incrementation occurs which guarantees that not more than one record
has the same primary key value. Of course, a DB constraint prevents
duplicate primary key values as well, so this works well and supports a
huge range of primary key values.
This all happens behind-the-scenes so you don't have to deal with this
in your code at all.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.