Author: tfischer
Date: Mon Nov 28 12:53:59 2005
New Revision: 349501

URL: http://svn.apache.org/viewcvs?rev=349501&view=rev
Log:
BaseObject.equals() does not return true anymore if the other object has a 
different class but the same primary key.
Fixes TRQS133.
Thanks to Patrick Carl for the patch.

Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java
URL: 
http://svn.apache.org/viewcvs/db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java?rev=349501&r1=349500&r2=349501&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java 
(original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java Mon 
Nov 28 12:53:59 2005
@@ -222,7 +222,8 @@
      * Compares the primary key of this instance with the key of another.
      *
      * @param bo The object to compare to.
-     * @return   Whether the primary keys are equal.
+     * @return   Whether the primary keys are equal and the object have the 
+     *           same class.
      */
     public boolean equals(BaseObject bo)
     {
@@ -235,6 +236,10 @@
             return true;
         }
         else if (getPrimaryKey() == null || bo.getPrimaryKey() == null)
+        {
+            return false;
+        }
+        else if (!getClass().equals(bo.getClass()))
         {
             return false;
         }



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

Reply via email to