db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walt Armour <Wa...@concur.com>
Subject RE: BaseObject equals problem
Date Sun, 02 Feb 2003 06:05:23 GMT
(xposting to get this over to Dev list)

I agree.  What should be happening is that torque should be generating an
equals override into the derived classes.  It is this override that should
be checking to make sure that the argument to equals is an instanceof this
class.

BTW, the (obj != null) check in BaseObject.equals(Object) is unnecessary
because instanceof is defined to return false if it's argument is null.

If no one else does it I can submit a patch for both of these (minor)
issues, probably late this week.

walt

> -----Original Message-----
> From: Boris Bliznukov [mailto:blib@dsi.ru] 
> Sent: Saturday, February 01, 2003 3: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
> 

Mime
View raw message