Quantcast

MyBatis Dynamic SQL Problems.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

MyBatis Dynamic SQL Problems.

srekar
I am using Spring MyBatis 1.1.0.

I am tryrin to use dynamic sql without much sucuss.

SQL mapping,.

<select id="getResultTypes" parameterType="java.util.Map" resultType="CodedAcrfTestResult">
               
                                SELECT
                                        ACRF_RESULT_CODE acrfResultCode, ACRF_RESULT_DESC acrfResultDesc  
                                FROM
                                        CODED_ACRF_TEST_RESULT
                                <if test="whereCondition=='yes'">
                                 WHERE
                                        PARENT_TEST_TYPE=#{parentTestType} AND ACRF_TEST_CODE=#{acrfTestCode}
                                </if>
                                                               
               
        </select>

Here is muy Map that is being passed,

Map pMap = new HashMap();
                pMap.put("testType", "01");
                pMap.put("testCode", "A1");
                pMap.put("whereCondition", "yes");

I get the error saying,
SQL command not properly ended;


Any idea where I am making mistakes?
Can anybody please help me?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: MyBatis Dynamic SQL Problems.

srekar
I think,  problem is coming from the CDATA  tags that I was using in the select. I removed those and seems it is working fine.
Loading...