Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 38853 invoked from network); 23 Aug 2009 03:54:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Aug 2009 03:54:55 -0000 Received: (qmail 63385 invoked by uid 500); 23 Aug 2009 03:55:17 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 63282 invoked by uid 500); 23 Aug 2009 03:55:17 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 63273 invoked by uid 99); 23 Aug 2009 03:55:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Aug 2009 03:55:16 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of anoopkumarv@gmail.com designates 209.85.220.220 as permitted sender) Received: from [209.85.220.220] (HELO mail-fx0-f220.google.com) (209.85.220.220) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Aug 2009 03:55:07 +0000 Received: by fxm20 with SMTP id 20so1225593fxm.0 for ; Sat, 22 Aug 2009 20:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=t2jLvIzMwAi3oobHqWm04HQM/mG2AQzx5rfP4JdGzsI=; b=uvP9eiajAE+Xh/iG6aXei/OYC4atG2NchnAwr9zxTF69sYn15tQkTId6PouLcakjwX j3ltCKQNAaRCcY/redhxFkIoNHp6EE/Yg9wR4/MKynX2iY3rxY0uldBKMiPFX298rj/u UQRNDxi57VXx9O4XcQncBYG7ghreDlv0jsfeA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=YGhCCVdWrTLGIpHER9r9nikOUU/3vPxyiC7O7vspSusg1NB8CVUTneyEERol4bay2u Xup8a47bKpAxbr2SILP16nmCFSTAoboMTnnQWjUseV8mhS8B0y/4K2BmrZPkussrHqhB JDxrTwxC91cF5Evime3fWtfN3np+klNvR8Pzc= MIME-Version: 1.0 Received: by 10.103.86.23 with SMTP id o23mr578298mul.116.1250999686144; Sat, 22 Aug 2009 20:54:46 -0700 (PDT) From: Anoop kumar V Date: Sat, 22 Aug 2009 23:54:26 -0400 Message-ID: Subject: Newbie question: Update table that has no key / id To: user-java@ibatis.apache.org Content-Type: multipart/alternative; boundary=0016e65aedd8e8241d0471c70f78 X-Virus-Checked: Checked by ClamAV on apache.org --0016e65aedd8e8241d0471c70f78 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, I am facing an issue updating a table that is part of a crappy datamodel. The table has no primary key. It has 3 columns user, region and division. My issue is when a user wants to modify a particular record, I am not sure how to pass the parameters... update user_approvers set region_name = #region:VARCHAR#, division_name = #division:VARCHAR#, where user = #user:VARCHAR# and region = #region:VARCHAR# and division=#division:VARCHAR# I know the above is hopelessly wrong, the where clause parameters is the same as the update values and this will never find the record and so will not update anything. I think there is a unique constraint or composite key set up for all 3 columns. I am using Oracle in production and mysql on my laptop if that makes a difference. Would using rownum or something make some sort of difference? Thanks, Anoop --0016e65aedd8e8241d0471c70f78 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I am facing an issue updating a table that is part of a crappy d= atamodel. The table has no primary key. It has 3 columns user, region and d= ivision.

My issue is when a user wants to modify a particular record= , I am not sure how to pass the parameters...

=A0 <update id=3D"updateUserApprover" parameterClass=3D&qu= ot;ad.UserApprover">
=A0=A0=A0 update user_approvers set region_= name =3D #region:VARCHAR#,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 division_name =3D #division:VARCHAR#,
=A0=A0=A0 where user =3D #user:VARCHAR#
=A0=A0=A0 and region =3D #region= :VARCHAR#
=A0=A0=A0 and division=3D#division:VARCHAR#
=A0 </update= >

I know the above is hopelessly wrong, the where clause paramete= rs is the same as the update values and this will never find the record and= so will not update anything.

I think there is a unique constraint or composite key set up for all 3 = columns. I am using Oracle in production and mysql on my laptop if that mak= es a difference. Would using rownum or something make some sort of differen= ce?


Thanks,
Anoop
--0016e65aedd8e8241d0471c70f78--