The hashcode field is definitely not needed in the table.  Do you have a
hashcode field in you Bean class?

Also, you may want to cache the hash value in your PK since your hashCode() is
pretty expensive.  You are creating a StringBuffer, a String and using String's
hashCode() which is recomputed on every call!

-Pete





"Indika Fernando" <[EMAIL PROTECTED]> on 02/14/2001 06:17:21 AM

Please respond to "jBoss" <[EMAIL PROTECTED]>

To:   "jboss" <[EMAIL PROTECTED]>
cc:    (bcc: Peter Cetinski/GELCO)

Subject:  [jBoss-User] why overide hashcode();



the hashcode() method is included in my PK class,
public int hashCode()
 {
        StringBuffer strBuff = new StringBuffer( );
        strBuff.append(userID);
        strBuff.append(listID);

  String str = strBuff.toString();
        int hashCode = str.hashCode( );
  return hashCode;
    }

When deploying using jboss it asks for a hashcode field ,I included it in
the Bean as well as in the deployment descriptor. I had to include a
hashcode field too in my table. Now my beans are working and I dont knpw why
this hashCode is needed in the table..The other problem is what should I
have for hashcode field when inserting records..
NEDD A QUICK REPLY
TIA.



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]









--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to