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 Leo Gaggl <le...@autom-8.com> on 2004/03/22 05:06:31 UTC

problem with BaseXYZPeer.doUpdate(object)

I have been pulling my hair out with the above method trying to update a 
record. When I try to update via a peer object the update method above 
does not produce any changes in the DB. The object passed into the 
method has the same parameters as the one below.
When I trace the calls to the db it seems the CAT_ID is null even though 
the object has the correct cat id.

After hours of trying with the object I used a criteria object. doing it 
via a criteria object works fine.

Criteria crit = new Criteria();
crit.add(EquipmentCategoryPeer.CAT_ID, catid.intValue());
crit.add(EquipmentCategoryPeer.CAT_DESC,(String)equipcatForm.get("catdesc"));
EquipmentCategoryPeer.doUpdate(crit);

My questions:

1) is this a known problem or has this been experienced before ? I have 
searched newsgroups and mailing list and can't find anything.

2) what's considered "best practice" doing updates via criteria or table 
objects ?

Thanks in advance,

Leo Gaggl
Adelaide, South Australia


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


Re: problem with BaseXYZPeer.doUpdate(object)

Posted by Scott Eade <se...@backstagetech.com.au>.
Leo Gaggl wrote:

> I have been pulling my hair out with the above method trying to update 
> a record. When I try to update via a peer object the update method 
> above does not produce any changes in the DB. The object passed into 
> the method has the same parameters as the one below.
> When I trace the calls to the db it seems the CAT_ID is null even 
> though the object has the correct cat id.
>
> After hours of trying with the object I used a criteria object. doing 
> it via a criteria object works fine.
>
> Criteria crit = new Criteria();
> crit.add(EquipmentCategoryPeer.CAT_ID, catid.intValue());
> crit.add(EquipmentCategoryPeer.CAT_DESC,(String)equipcatForm.get("catdesc")); 
>
> EquipmentCategoryPeer.doUpdate(crit);
>
> My questions:
>
> 1) is this a known problem or has this been experienced before ? I 
> have searched newsgroups and mailing list and can't find anything.

The problem is most likely that you are not specifying the database name 
in your schema.

> 2) what's considered "best practice" doing updates via criteria or 
> table objects ?

Via table objects.


Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



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


Re: Antwort: problem with BaseXYZPeer.doUpdate(object)

Posted by Leo Gaggl <le...@autom-8.com>.
Florian et al,

Thanks a lot guys !!

I've got a bit of a red face here.

 > Did you read the Record from the DB before updating it?

Turned out I didn't do that properly.

This reassures me, that I have chosen the right framework with Torque. 
Great piece of work !!! I hope to be able to contribute something back 
once I have got my head around the whole thing.
I had to do some adjustments to the Velocity templates for MSSQL to make 
it work properly with one of my table names (which turned out to ba a 
restricted word - and i could not change it for legacy reasons). Is it 
worth submitting ?

Schoene Gruesse von 'down under' ins alte Europa.

Leo

FlorianFray@deuka.de wrote:
> Normally doUpdate(DBObject) works fine. 
> Did you read the Record from the DB before updating it?
> I'd say: Post a code snippet!
> 
> Florian Fray
> Wuppertal, Germany

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


Antwort: problem with BaseXYZPeer.doUpdate(object)

Posted by Fl...@deuka.de.
Normally doUpdate(DBObject) works fine. 
Did you read the Record from the DB before updating it?
I'd say: Post a code snippet!

Florian Fray
Wuppertal, Germany