If one part of the PK is well distributed (as, for example, the Timestamp
seems likely to be in this case) then a reasonable option is to use that to
supply the hashcode and ignore the rest of the PK. Remember that hashCodes
do NOT need to be unique. They only NEED to obey the constraint that they
are the same for two PKs for which equals() is true.
Ben Strulo
> -----Original Message-----
> From: Thomas Preston [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, June 29, 2000 4:24 PM
> To: [EMAIL PROTECTED]
> Subject: hashCode for entity bean with multiple pk columns
>
> Anyone have suggestion regarding standard way to write int hashCode()
> method
> now required in PK when one has multiple PK's.
>
> If I have one PK value (Integer myInteger) I do this:
>
> public int hashCode() {
> return myInteger.hashCode();
> }
>
> How about if I have two Ingegers and a Timestamp making up my PK, what is
> a
> nice simple clean way to write hashCode method?
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> ==========================================================================
> =
> 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".