ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: selectKey not working - #value# is repeating id.
Date Tue, 20 Jun 2006 17:45:02 GMT
If your parameterclass is string, there is nowhere to put the generated id.

Use a bean or a map, and set the description on that object to the
description you want to insert.

Also, you'll want to set the keyProperty to "id" in your selectKey element.

Larry


On 6/20/06, jaybytez <jaybytez@gmail.com> wrote:
>
> I have the following insert into a codes lookup table:
>
>   <insert id="insertBatchFacilityServiceLookup"
>     parameterClass="string">
>     <selectKey resultClass="int" >
>         <![CDATA[
>         SELECT foo_lookup_seq.nextval AS id
>         FROM dual
>         ]]>
>         </selectKey>
>     <![CDATA[
>                 INSERT INTO foo_lookup ( foo_code, foo_desc )
>                 VALUES (#id#, #value#)
>     ]]>
>   </insert>
>
> I am sending a String into this insert and the String represents the
> foo_desc.  But when I run this query and debug into the iBatis code...the
> parameters for this query show ("This is the description", "This is the
> description") instead of the (code, desc) like (10000, "This is the
> description").  I assume the usage of #id# outputs the response from the
> selectKey, but I think that the #value# is also outputting the response from
> the selectKey and not the String from the parameterClass.  Anyway to get
> around this?
>
> Thanks,
>
> jay blanton
> --
> View this message in context: http://www.nabble.com/selectKey-not-working----value--is-repeating-id.-t1819062.html#a4959670
> Sent from the iBATIS - User - Java forum at Nabble.com.
>
>

Mime
View raw message