I think the answer is:

Vector v = TPeer.doSelect(new Criteria().add(TPeer.COL2,20));

then iterate over the vector and do

obj.setCol1(10);
obj.save();

for each of them.

this is not very efficient, but that is because Torque is not designed to do
bulk updates - as bulk update idea is inehrently foreign to objects...

of course, you can always do TPeer.executeStatement("update T set col1=10
where col2=20");

fedor.

-------------------------------
Amicus Plato amicus Aristoteles magis amica veritas

> -----Original Message-----
> From: Gonzalo Diethelm [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 8:32 AM
> To: [EMAIL PROTECTED]
> Subject: How to doUpdate for a non-key column?
> 
> 
> Well, after a couple of weeks off the list, I'm back!.
> 
> I have a table T like this:
> 
>   id number key
>   col1 number
>   col2 number
> 
> and want to issue an update like this:
> 
>   update T set col1=10 where col2=20
> 
> Is this possible with vanilla Peers (and Turbine 2.x)? Notice 
> the update is not referring to the key column at all; in 
> fact, the update could potentially affect 0, 1 or more rows.
> 
> Thanks,
> 
> 
> -- 
> Gonzalo
> 
> 
> --
> Gonzalo A. Diethelm
> [EMAIL PROTECTED]
> 
> --
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to