Search code examples
ibatismybatis

Passing multiple arguments into a SELECT without using a complex object


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>

Solution

  • @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

    <select id="retrieveTestXXX" parameterClass="java.util.Map" resultClass="java.lang.Integer">
        SELECT
        example_table.id
        FROM example_table
        WHERE example_table.xx_id = #testId# AND example_table.xx_id = #test2Id#
    </select>
    

    Hope this helps.