I believe that we override hashcode() to ensure same hashcode for the same
primary key everytime the container calls it. It is essential because each
entity bean maps to a single row in database. So it is essential that the
same primary key is evaluated to same hashcode everytime. Container maintains
the identity of the entity bean in a hashtable where hashcode and primary key
are key, value pairs. that is ensured by overriding the hashcode() method.
Again we override equals() method to find out whether the primary key is same
or not.
Satya
Dan Christopherson wrote:
>
> It is anticipated that the container will use that in its cacheing
> operations.
>
> On Fri, 16 Feb 2001, sanju wrote:
>
> > Can anyone tell me why do we have to override the hashCode method in
> > PrimaryKey class though we never use it?
> > Thanks in advance
> > sanjeev
===========================================================================
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".