You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Carfield Yim <ca...@carfield.com.hk> on 2006/11/14 10:14:40 UTC
Can I use resultMap for insert?
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.
Re: Can I use resultMap for insert?
Posted by Carfield Yim <ca...@carfield.com.hk>.
So I have to accept the duplication of those parameters for insert and
select? Because for me case they will be existlly same
puneet arya wrote:
>
> hi,
> use it different instead of putting in one and as larry told use
> parameterMap for insert statement..
>
> Puneet Arya
>
> Larry Meadors <lm...@apache.org> wrote:
> Not a resultMap, but you can use a parameterMap as explained in the user
> guide.
>
> Larry
>
>
> On 11/14/06, Carfield Yim wrote:
>>
>> We've already create a resultMap for select data from database. However
>> we
>> need to retype everything for insert query, like
>>
>> > parameterClass="com.domain.Product">
>> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
>> values (#id#,#description#)
>>
>> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>>
>>
>>
>> Can I reuse resultMap so that I can have something like
>>
>> > parameterClass="com.domain.Product">
>> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
>> values (?,?)
>>
>> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>>
>>
>>
>> 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.
>>
>>
>
>
>
> ---------------------------------
> Find out what India is talking about on - Yahoo! Answers India
> Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8.
> Get it NOW
>
--
View this message in context: http://www.nabble.com/Can-I-use-resultMap-for-insert--tf2628161.html#a7340566
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Can I use resultMap for insert?
Posted by puneet arya <pu...@yahoo.co.in>.
hi,
use it different instead of putting in one and as larry told use parameterMap for insert statement..
Puneet Arya
Larry Meadors <lm...@apache.org> wrote:
Not a resultMap, but you can use a parameterMap as explained in the user guide.
Larry
On 11/14/06, Carfield Yim wrote:
>
> We've already create a resultMap for select data from database. However we
> need to retype everything for insert query, like
>
> > parameterClass="com.domain.Product">
> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
> values (#id#,#description#)
>
> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>
>
>
> Can I reuse resultMap so that I can have something like
>
> > parameterClass="com.domain.Product">
> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
> values (?,?)
>
> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>
>
>
> 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.
>
>
---------------------------------
Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
Re: Can I use resultMap for insert?
Posted by Larry Meadors <lm...@apache.org>.
Not a resultMap, but you can use a parameterMap as explained in the user guide.
Larry
On 11/14/06, Carfield Yim <ca...@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.
>
>