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 Giulio Vezzelli <gi...@infolog.it> on 2004/03/16 11:37:41 UTC

Torque BaseObjects' sons have wrong hashCodes ?!

I'm trying to use hashCode() to identify business objects generated by
Torque...
 
Let's say I'm using an object called User.
 
When the object is instantiated as a New User(), if I check hashCode()
immediately after instantiation the integer returned is different every time
I call hashCode() !!!
 
If I use check a User object obtained via retrieveByPK, the hashCode()
function is coherent. I checked a bit through Torque's source, but I can't
see why the hashCode is always different... looks like I get the hashCode
for a newly instantied object every time.
 
Any suggesitions ?!?!? 
 
Giulio Vezzelli
Infolog S.r.l.
Via Alfieri, 28
Modena - 41100
Telefono : +39-059-822446
Sito web : http://www.infolog.it <http://www.infolog.it/> 
E-mail : giulio.vezzelli@infolog.it
 
 

R: Torque BaseObjects' sons have wrong hashCodes ?!

Posted by Giulio Vezzelli <gi...@infolog.it>.
> > I'm trying to use hashCode() to identify business objects 
> generated by 
> > Torque...
> 
> Why?

To identify each instance of each object...
I have to check some actions in a web application aren't repeated by using
the "Back" button on the browser.

> > When the object is instantiated as a New User(), if I check 
> hashCode() 
> > immediately after instantiation the integer returned is different 
> > every time I call hashCode() !!!
> 
> I don't know how it's generated, but perhaps it uses values 
> in the fields and when empty... does something else?

I found why... It returns hashCode from a "new SimpleKey" object, which, of
course, is always different.
This doesn't happen when the key is not empty...

I'll use some other method...

Bye

Giulio Vezzelli
Infolog S.r.l.
Via Alfieri, 28
Modena - 41100
Telefono : +39-059-822446
Sito web : http://www.infolog.it
E-mail : giulio.vezzelli@infolog.it
 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Torque BaseObjects' sons have wrong hashCodes ?!

Posted by Dave Newton <da...@solaraccess.com>.
On Tue, 2004-03-16 at 05:37, Giulio Vezzelli wrote:
> I'm trying to use hashCode() to identify business objects generated by
> Torque...

Why?

> When the object is instantiated as a New User(), if I check hashCode()
> immediately after instantiation the integer returned is different every time
> I call hashCode() !!!

I don't know how it's generated, but perhaps it uses values in the
fields and when empty... does something else?

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org