Hi,

You can probably not use the hashCode method to get unique numbers.
>From the documentation of Object.hashCode():

"It is not required that if two objects are unequal according to the
equals(java.lang.Object) method, then calling the hashCode method on each of
the two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results for
unequal objects may improve the performance of hashtables. "

So two objects which aren't equal can produce the same hash code.
"Normal" hashCode implementations usually creates well distributed hash
codes, but not unique ones.

/Kaj


~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~  ~   ~
[EMAIL PROTECTED]
+46 70 4200148



> -----Original Message-----
> From: E Bakka Reddy [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 06, 2001 12:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Autonumber primary keys
>
>
> Hi Myles
>
> I am getting the keys like following
>
> UID random key gen...111f71:e15229e846:-8000 VMID random key
> gen...9cce8edc2a0eb045:111f71:e15229e846:-7fff
>
> but my database field is integer type, how this is useful,
> but there is a
> hashCode() method on these classes, can we use it, is it correct way.
>
> Thanks,
> Reddy
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff EJB-INTEREST".  For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to