Hi,

Look at JDK API docs on Object.hashCode() and Object.equals() for the
qualified explaination.

Long story short:  the reason why you need to implement these 2 functions
for your PK is the same reason why you need to implement these 2 functions
for your custom class if you want to use it as a key in a java.util.Map.  If
you don't, you will never find these keys because by default
Object.hashCode() and Object.equals() returns you the reference address of
the objects, which good for compare-by-reference and not compare-by-value!

Gene

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Jon Finanger
Sent: Monday, August 21, 2000 4:24 AM
To: [EMAIL PROTECTED]
Subject: Re: Primary key


> >Is it neccesary to compute the hashCode() in BMP?
>
> Yes. Primary key classes must always implement both hashCode and equals.

Whats the reason for that?
I was a kind of thinking that this was a special case/most useful for
CMP....

\Jon

===========================================================================
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