ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Abator update problem
Date Sat, 08 Sep 2007 02:29:48 GMT
Abator generated code won't do this now.  I am working on an
"updateByExample" method for the next release of Abator that will allow
this.

BTW...relational purists would frown on this anyway.  Changing the primary
key of a record is problematical if there are any foreign keys related to
the table.  Also, it's not clear what the intent is when changing a primary
key - was the record related to the wrong employee, or did the employee id
change?

Jeff Butler


On 9/7/07, Robert Glover <robertgloverjr@yahoo.com> wrote:
>
> I am trying to use Abator to do the equivalent of the following SQL
> statement, which as you can see is changing the "EMP_ID".  "EMP_ID" and
> "SERIAL_NUM" together comprise the primary key.
>
> "UPDATE    ATADMIN.IAT_ASSET
> SET EMP_ID =  ? ,
> BUDGET_UNIT =  ? ,
> ASSET_COMMENT =  ? ,
> DECOMM_REQ_FLG =  ?
> WHERE
> (      ( ATADMIN.IAT_ASSET.EMP_ID =  ?  )
> AND ( ATADMIN.IAT_ASSET.SERIAL_NUM =  ?  )    )";
>
>   The only two methods Abator created in the "IatAssetDAO" are the
> following
> two, which do not provide me any way to change the value of the primary
> key
> because it is used in the where clause.  Please advise-- am I out of luck
> or is
> there a way to coax Abator into doing this update.
>
>    /**
>     * This method was generated by Abator for iBATIS.
>     * This method corresponds to the database table ATADMIN.IAT_ASSET
>     *
>     * @abatorgenerated Fri Sep 07 17:08:13 EDT 2007
>     */
>    int updateByPrimaryKey(IatAsset record);
>
>    /**
>     * This method was generated by Abator for iBATIS.
>     * This method corresponds to the database table ATADMIN.IAT_ASSET
>     *
>     * @abatorgenerated Fri Sep 07 17:08:13 EDT 2007
>     */
>    int updateByPrimaryKeySelective(IatAsset record);
>
>
>
>
>
>
>

Mime
View raw message