Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 43480 invoked from network); 4 May 2004 14:08:58 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 May 2004 14:08:58 -0000 Received: (qmail 2864 invoked by uid 500); 4 May 2004 14:08:50 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 2745 invoked by uid 500); 4 May 2004 14:08:49 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 2634 invoked from network); 4 May 2004 14:08:48 -0000 Received: from unknown (HELO zwei.siemens.at) (193.81.246.12) by daedalus.apache.org with SMTP; 4 May 2004 14:08:48 -0000 Received: from bavc001a.bav.siemens.ro (pix6-pri.frust.net [193.81.246.198] (may be forged)) by zwei.siemens.at (8.12.9/8.12.8) with ESMTP id i44E8mK0018283 for ; Tue, 4 May 2004 16:08:49 +0200 Received: by bavc001a.bav.siemens.ro with Internet Mail Service (5.5.2653.19) id ; Tue, 4 May 2004 17:05:58 +0300 Message-ID: <21115DCA7CC1D51189F100E0181E406501142A41@bavc001a.bav.siemens.ro> From: Dovlecel Alexandru Ovidiu To: "'Apache Torque Users List'" Subject: RE: hashCode/equals contract broken in BaseObject Date: Tue, 4 May 2004 17:05:57 +0300 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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:shevek@anarres.org] 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: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org