You can use torque objects as hash keys with one condition: 

all the keys in the hashtable must be instances of the same torque class.
Then you will not have any inconsistency. 

-----Original Message-----
From: Shevek [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 04, 2004 4:07 PM
To: Apache Torque Users List
Subject: hashCode/equals contract broken in BaseObject


hashCode and equals in BaseObject rely only on the primary key. This
breaks horribly (violates the general contract of hashCode()/equals()) if 
you compare two objects of different classes.

It MUST compare ob.getClass() as well as ob.getPrimaryKey() and include
ob.getClass().hashCode() in its hashCode() [by xor?] [or something
equivalent].

No doubt the reason for this violation is noted in the FAQ, but it seems
worth noting as a serious bug since it means I can't use Torque objects as 
hash keys.

S.

-- 
Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to