ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralf Assmann <ralf.assm...@innovations.de>
Subject Update Primary Key Using Primary Key
Date Wed, 18 Oct 2006 07:35:00 GMT

Hi there,

we are using a database table with three columns column1, column2, 
column3. The primary key are column1 and column2.

Now, we want to do an update using iBatis, the column2 should be 
updated. The update itself should be done by using the primary key as 
the where part. For this, we created (at least we wanted to do so) the 
following sql statement:

update table set column2 = #?# where column1 = #column1# and column2 = 

The parameters are part of a parameter class, using the getter of this 
class. The problem now is, that the update should be done by the 
attributes of the primary key, but the primary key itself should be 
modified. That is the parameter #?# in the statement above.

How is it possible to pass the parameter for the update using the 
parameter class? Writing #column2# instead of #?#,  the set part will 
use the same value as the value used in the where part (so the update 
does not make any sense).  Is there any way in doing so using a 
parameter class or can't this be done by a parameter class and a map has 
to be used (including keys like 'column2new' and 'column2old')?

Thanks for your answers.

Best regards,


View raw message