ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "meindert" <meind...@eduflex.com>
Subject RE: Multiple parameters in sqlmap parameters.
Date Wed, 03 Jun 2009 07:00:26 GMT
Use a map as parameterClass.
As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>(); 
param.put("id", yourInt);
param.put("description", yourString);


-----Original Message-----
From: NathanM [mailto:nathan.mellor@infdig.com] 
Sent: 01 June 2009 11:45 PM
To: user-java@ibatis.apache.org
Subject: Multiple parameters in sqlmap parameters.


Please excuse me if this turns out to be a dumb question. 

Is it possible to do something simple like pass two int parameters into a
statement?

These are the examples I see in the manual:

One simple type:

<statement id="getProduct" parameterClass="System.Int32">
  select * from PRODUCT where PRD_ID = #value#
</statement>

One complex type:

<parameterMap id="insert-product-param" class="Product">
  <parameter property="description" />
  <parameter property="id"/>
</parameterMap>

<statement id="insertProduct" parameterMap="insert-product-param">
  insert into PRODUCT (PRD_DESCRIPTION, PRD_ID) values (?,?);
</statement>

One complex type inline:
<statement id="insertProduct" parameterClass="Product">
  insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
  values (#id:int#, #description:VarChar#)
</statement>

Is there any example for two simple types? Or do I need to come up with a
class that has two int properties so I can pass int two ints?


Nathan
-- 
View this message in context:
http://www.nabble.com/Multiple-parameters-in-sqlmap-parameters.-tp23822891p2
3822891.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.51/2151 - Release Date: 06/02/09
17:53:00


Mime
View raw message