how to use dynamic parameters in select statement in iBatis 3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to use dynamic parameters in select statement in iBatis 3

Radh
In Ibatis 2 , I used below select statement.

<select id="getWPIData" parameterClass="java.lang.String"
resultMap="PMWSFTCSMap">
select
Line_No,ip_name,ip_title,cs_identifier,change_order,SOI_Status,SOI_Completion_Date,Model
from FTCS_WRK_PKG_INFO $whereClause$ order by Model,Line_No,ip_name
</select>

Now in Ibatis 3 I am supposed to use below select statement syntax
which is not working.

<select id="getWPIData" parameterType="java.lang.String"
resultType="WorkPkgInfo" resultMap="PMWSFTCSMap">
select
Line_No,ip_name,ip_title,cs_identifier,change_order,SOI_Status,SOI_Completion_Date,Model
from FTCS_WRK_PKG_INFO #{whereClause} order by Model,Line_No,ip_name
</select>

In this case whereClause variable holds the follwoing value "model =
'747' and Line_No in (1424) or model = '787' and Line_No in
(5,2,6,3,4) or model = '737' and Line_No in
(3356,2570,3464,2965,3052,3393,3138,3244)" which will be generated
dynamically based on the request that we get.

Is there any otherway to specify the parameters? According to iBatis
user guide it should be #{whereClause} .


Loading...