I am trying to pass in startSequenceId
, stopSequenceId
, orderNumber
into the SQL map, however, i don't wish to use a typed object, i.e. parameterType="com.abc.Order"
, can i do so?
<select id="getSequenceIdByOrderNumber" parameterType="?" resultType="int">
select *
from log
where seq_id
between #{startSequenceId} and #{stopSequenceId}
and order_no = #{orderNumber}
and rownum = 1
</select>
Found the answer, thanks.
http://code.google.com/p/mybatis/wiki/HowToSelectMultipleParams
You can use the built in parameterType 'map' eg
In MyBatis 3, you can use
@Param
annotation in your mapper class(interface) method:Then you can use
#{seqId}
,#{orderId}
in the SQL without using parameterType attribute.cant comment,
this link is broken, currently correct one is https://github.com/mybatis/mybatis-3/wiki/FAQ#how-do-i-use-multiple-parameters-in-a-mapper
copy + paste from this wiki
tl;dr
when you declare method in your interface instead of standard java structure
use (add @Param)
@Chin I'll post what I had typed anyway with a simple example though you found what your looking for. My example using iBatis 2.3.4
Hope this helps.