You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2005/11/28 21:54:05 UTC

svn commit: r349501 - /db/torque/runtime/trunk/src/java/org/apache/torque/om/BaseObject.java

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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org