Regarding portability, that can probably best be handled by abstracting it
out into a pluggable interface (which I realize the entity framework is
trying to avoid.)  So the code would say "get next unique id" and the Oracle
plug-in would get the next number from its sequence, while Sybase would spin
its auto-increment column.

Entire discertations and books have been written on the subject of unique
identifiers.  No solution is perfect.  For example, in the GUID discussion
below, it is entirely possible to get duplicates on one MAC address.  First,
CPUs are getting so fast that you can generate several timestamps with the
same value given the resolution of the timestamp and the CPU clock.
Secondly, in a multi-CPU system, you can generate duplicate timestamps
trivially.  Certainly if you pay $200,000 on an 8-CPU server you don't want
them all lock-waiting on a centralized timestamp dispenser.

----- Original Message -----
From: "Peter Routtier-Wone" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 04, 2001 11:44 AM
Subject: Re: [JBoss-user] Writing a finder which returns max id used


> > You can also use the facilities of the database engine to help with this
> > problem.  Oracle has sequences which guarantee a unique number even with
> > concurrent access.  Sybase has autoincrement columns.
>
> Use of the database as a UID dispenser has its merits with respect to the
> concurrency issue, but it raises portability issues.
>
> Another possibility is one of the few really good ideas to come out of
> Redmond - the GUID.
>
> GUIDs are unique in space and time. The first eight bytes are a machine
> identifier (based on the MAC address of your network interface, if I
> remember correctly) and the second eight bytes are a timestamp. The
benefit
> of this approach is that it is not necessary to contact any other computer
> to derive a unique value. The downside is that string comparisons - and
> worse yet string based indexes - are *expensive*. But they are seldom as
> expensive as contacting another machine, or rolling back and re-running a
> transaction.
>
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to