You can try this:
make a String object concatenating the values of the fields of your primary
key and then use the hashCode() method of String to obtain a hash code:
hasCode() {
String str = field1.toString()+ field2.toString();
return str.hashCode();
}
Regards
Luis F. Canals Samaniego
CEDETEL
Parque Tecnol�gico de Boecillo
Edificio Centro, Parcela 109
E-47151 Boecillo (Valladolid)
-----Mensaje original-----
De: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]En nombre de Thomas Preston
Enviado el: jueves 29 de junio de 2000 17:24
Para: [EMAIL PROTECTED]
Asunto: 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".