简体   繁体   中英

spring property howto escape special characters in sql?

I got this property in my spring configuration of my dao project:

<property name="LBQC">
            <value>
                SELECT u.name, u.cq
                FROM user u
                WHERE u.cq <> 0 ORDER BY u.cq DESC;
        </value>
        </property>

Unfortunality I have a problem with that <> notation. It leads to The content of elements must consist of well-formed character data or markup. I am not familiar with xml . How can I escape those kind of characters?

Thanks for your help.

Stefan

replace it with &lt;&gt; or encapsulate the entire query in CDATA

I think you can use != instead of <> in your query to have the same result

SELECT u.name, u.cq
FROM user u
WHERE u.cq != 0 
ORDER BY u.cq DESC;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM