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 Newbie question: Update table that has no key / id
Date Sun, 23 Aug 2009 03:54:26 GMT
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 id="updateUserApprover" parameterClass="ad.UserApprover">
    update user_approvers set region_name = #region:VARCHAR#,
                      division_name = #division:VARCHAR#,
    where user = #user:VARCHAR#
    and region = #region:VARCHAR#
    and division=#division:VARCHAR#
  </update>

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

Mime
View raw message