Hello Dain,

Tuesday, May 14, 2002, 12:16:44 AM, you wrote:

>> Here is hashCode function (the same in UserPK and ResourceOwnerPK):
>> public int hashCode() {
>>   if( _hashCode == Integer.MIN_VALUE )
>>     _hashCode += this.username.hashCode(); // line 59
>>   return _hashCode;
>> }


DS> this.username is null.  Do you have this field in both classes, so you 
DS> have a shadowed field.  By the way, this is a dangerous hash function as 
DS> when the pk is serialized the hashCode will be reset to 0 not 
DS> Integer.MIN_VALUE assuming it is marked a transient.

  Yes, I have username in both ResourceOwnerPK and in UserPK classes and
in ResourceOwnerPK I get shadowed field. It seems it causes the
problem but I just can't understand why! and how?

  As to hashCode, you're rigth. It's generated by XDoclet and there is
a bug for it. For now I just commented 'transient' key.

DS> Also check that you implemented equals correctly.  You must check for an 
DS> exact type match first.

That is correct. I am sure.

Dain, do you have some thoughts what causes the problem? I agree the
code isn't smooth. It's generated :)

TIA

-- 
Best regards,
 Alex Loubyansky                           mailto:[EMAIL PROTECTED]



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to