MyBatis and Ibatis Dynamic SQL statement configuration symbols, incompatible with special symbol issues such as greater than sign, less than sign X

Source: Internet
Author: User
Tags cdata

TEST


In the XML map SQL file, in many cases will use the greater than, less than the special symbols, such as, if you do not control is not compiled through, this time need to use the <![ cdata[]]> symbols are described, and the symbols are not parsed, In fact, this problem is not only common in mybatis, but it is common to any XML file used, such as Hibernate, Wabacus, spring, etc. in the configuration file, as long as the XML file is the line, such problems in the future work, often used.


Case code

<select id= "findallkiaanalysisbycondition" parametertype= "map" resulttype= "kiaanalysis" >select * FROM (SELECT Unitname, To_char (rdate, ' yyyy-mm ') Rdate,keytype, scope from kiaanalysis<where><if test= ' startDate!= '%null% "' > and Rdate >= to_date (#{startdate}, ' yyyy-mm ') </if><if test= ' enddate!="%null% "' ><strong> <span style= "color: #3333ff;" ><! [Cdata[</span><span style= "color: #3366ff;" > </span></strong>and rdate <= to_date (#{enddate}, ' yyyy-mm ') <span style= "color: #3333ff;" ><strong>]]></strong></span></if><if test= ' unitname!= "%null%" ' >and unitname= #{unitname}</if></where>) Pivot (sum (scope) for KeyType in (${themes})) </select>



TEST

MyBatis and Ibatis Dynamic SQL statement configuration symbols, incompatible with special symbol issues such as greater than sign, less than sign X

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.