db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KERNEUZET FREDERIC" <Frederic.Kerneu...@pr-gicm.com>
Subject RE : Torque is inserting, not updating
Date Wed, 23 Mar 2005 08:35:54 GMT
Hi,

On my side i got the reverse reaction :
It was trying to update a row while i was expecting an insert.

And i also had to use the setNew() method to tell Torque my object was a new one ...

So, in your application it seems to do an insert by default, and in mine it seems to be an
update by default, it's a little bit strange, i don't manage to find any information specifying
this in the Torque configuration file.


Frédéric.

-----Message d'origine-----
De : Will Keeling [mailto:w.keeling@tiscali.co.uk] 
Envoyé : mercredi 23 mars 2005 09:29
À : torque-user@db.apache.org
Objet : Torque is inserting, not updating

Hi,

I'm new to Torque and I'm having a slight problem where I'm calling save()
on a Torque object and it's doing an insert when I'm expecting it to do an
update.

I'm creating a new object and setting a number of it's fields including it's
primary key field - an 'id' field which is of type 'int'. I would have
expected Torque to realise that with the primary key field set, the object
it's not considered to be new and therefore it should attempt an update. But
it always does an insert.

The way round this I've found is to call setNew(false) on my object before
calling save() to force Torque to do the update.

Is calling setNew(false) the right way to be doing this (I wouldn't have
thought so)?

I'd be grateful for any advice!

Many thanks in advance,

Will



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


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


Mime
View raw message