Norton,

    Your PK equals method:

public boolean equals(Object obj) {
    GUID compareTo = (GUID)obj;

    if (_guid.toString().equals(compareTo.toString())) {
      return(true);
    }

    return(false);
  }

The correct would be:
...
    if (_guid.toString().equals(compareTo._guid.toString())) {
...

 Correct?

    Rafael

On Fri, 18 May 2001, Norton Lam wrote:

> I changed my hashCode() method as recommended below.  I also
> made the default constructor change as recommended in the
> posts referenced by Alexander (sorry I forgot to check the
> archives first).
> 
> However, I'm still getting the same warnings.
> 
> Any other suggestions?
> 
> Thanx.
> 
> Norton
> 
> -----Original Message-----
> From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 17, 2001 5:14 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] Primary Key warnings
> 
> 
> > 
> >   /**
> >    * Hash code method.
> >    */
> >   public int hashCode() {
> >     return(super.hashCode());
> >   }
> 
> 
> This is the problem. This is delegating to the Object.hashCode method 
> that uses the object's address as its input, so when the verifier tries 
> to verify that your hashCode method is right (by creating two keys and 
> comparing the hashes) it gets different answers when it should get the 
> same answer.
> 
> maybe
>       return _guid.toString().hashCode()
> 
> ?
> 
> -danch
> 
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to