ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anoop kumar V <anoopkum...@gmail.com>
Subject Re: Newbie question: Update table that has no key / id
Date Mon, 24 Aug 2009 13:10:57 GMT
Thanks Larry. I think your suggestion will work, but I was hoping
there was an ibatis way of handling this - or that I could use the
database specific rownum or something similar.

Would it make a big difference if the table had a composite key, such
that no 2 rows have exactly the same column values?

Thanks again,
Anoop

On 8/23/09, Larry Meadors <larry.meadors@gmail.com> wrote:
> You can do it a few ways, I think I'd put the old values and new
> values in a bean, then put those beans in a map and call them "old"
> and "new".
>
> Pass that map to the update and change it to this:
>
>   <update id="updateUserApprover">
>     update user_approvers set region_name = #new.region:VARCHAR#,
>                       division_name = #new.division:VARCHAR#,
>     where user = #old.user:VARCHAR#
>     and region = #old.region:VARCHAR#
>     and division=#old.division:VARCHAR#
>   </update>
>
> Larry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>


-- 

Thanks,
Anoop

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


Mime
View raw message