You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Boris Bliznukov <bl...@dsi.ru> on 2003/02/02 00:39:52 UTC

BaseObject equals problem

Hello turbine-torque-dev,

I notice that if I have two tables A and B, each having one numerical
primary key. So I will have two subclasses of BaseObject A and B. Now
for example if I get object from table A with primary key 1. And
object from table B with primary key 1.

A.equals(B) will return true ... I think it is wrong. It should return
false.

Both A and B inherit equals from BaseObject and it only compares the
value of the primary key if object passwd to equals is a subclass of
BaseObject. I think it also should compare runtime class names. Am I
wrong?

-- 
Best regards,
 Boris                          mailto:blib@dsi.ru


RE: BaseObject equals problem

Posted by Quinton McCombs <qm...@nequalsone.com>.
I am curious.  How is it that you have two objects from the same table
with the same primary key, yet they are different classes?  I understand
persisting multiple objects to the same table...  But how are you
getting two different classes with the same primary key?

> -----Original Message-----
> From: Boris Bliznukov [mailto:blib@dsi.ru] 
> Sent: Saturday, February 01, 2003 5:40 PM
> To: turbine-torque-user@jakarta.apache.org
> Subject: BaseObject equals problem
> 
> 
> Hello turbine-torque-dev,
> 
> I notice that if I have two tables A and B, each having one 
> numerical primary key. So I will have two subclasses of 
> BaseObject A and B. Now for example if I get object from 
> table A with primary key 1. And object from table B with 
> primary key 1.
> 
> A.equals(B) will return true ... I think it is wrong. It 
> should return false.
> 
> Both A and B inherit equals from BaseObject and it only 
> compares the value of the primary key if object passwd to 
> equals is a subclass of BaseObject. I think it also should 
> compare runtime class names. Am I wrong?
> 
> -- 
> Best regards,
>  Boris                          mailto:blib@dsi.ru
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> turbine-torque-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> turbine-torque-user-help@jakarta.apache.org
> 
> 


RE: BaseObject equals problem

Posted by Quinton McCombs <qm...@nequalsone.com>.
I created a Scarab issue for this....

http://scarab.werken.com/scarab/issues/id/TRQS133

> -----Original Message-----
> From: Boris Bliznukov [mailto:blib@dsi.ru] 
> Sent: Saturday, February 01, 2003 5:40 PM
> To: turbine-torque-user@jakarta.apache.org
> Subject: BaseObject equals problem
> 
> 
> Hello turbine-torque-dev,
> 
> I notice that if I have two tables A and B, each having one 
> numerical primary key. So I will have two subclasses of 
> BaseObject A and B. Now for example if I get object from 
> table A with primary key 1. And object from table B with 
> primary key 1.
> 
> A.equals(B) will return true ... I think it is wrong. It 
> should return false.
> 
> Both A and B inherit equals from BaseObject and it only 
> compares the value of the primary key if object passwd to 
> equals is a subclass of BaseObject. I think it also should 
> compare runtime class names. Am I wrong?
> 
> -- 
> Best regards,
>  Boris                          mailto:blib@dsi.ru
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> turbine-torque-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> turbine-torque-user-help@jakarta.apache.org
> 
>