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: Can I use resultMap for insert?
Date Tue, 14 Nov 2006 12:42:31 GMT
Not a resultMap, but you can use a parameterMap as explained in the user guide.

Larry


On 11/14/06, Carfield Yim <carfield@carfield.com.hk> wrote:
>
> We've already create a resultMap for select data from database. However we
> need to retype everything for insert query, like
>
> <insert id="insertProduct-ORACLE-type-specified"
> parameterClass="com.domain.Product">
>        insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
>        values  (#id#,#description#)
>       <selectKey resultClass="int" type="pre" >
>               SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>       </selectKey>
> </insert>
>
> Can I reuse resultMap so that I can have something like
>
> <insert id="insertProduct-ORACLE-type-specified" resultMap="productResult"
> parameterClass="com.domain.Product">
>        insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
>        values  (?,?)
>       <selectKey resultClass="int" type="pre" >
>               SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>       </selectKey>
> </insert>
>
> And then ibatis will help me to field suitable attribute from object to SQL
> parameters?
> --
> View this message in context: http://www.nabble.com/Can-I-use-resultMap-for-insert--tf2628161.html#a7333890
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message