ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carfield Yim <carfi...@carfield.com.hk>
Subject Can I use resultMap for insert?
Date Tue, 14 Nov 2006 09:14:40 GMT

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