您的位置:首页 > 数据库

当ibatis 包含大于小于号的sql语句

2011-10-08 08:25 162 查看
最近不是很熟悉iBatis,写sql时遇到包含大于号小于号的问题,原来如此::

莫纠结莫纠结:

IBatis的Mapper配置文件中使用大于号>和小于号<时,要使用

<![CDATA[

sql语句

]]>

来将sql语句括起来,如:

<select id="test_query" parameterType="hashmap" resultType="hashmap">

<![CDATA[

select t.f1,t.f2

from table t

where t.f3 <> 1

]]>

<include refid="test_sql_common" />

</select>

或者:

<select id="searchEventCountBy" resultClass="java.lang.Integer" >

select count(1) as count from BT_Event where alarmClear=0 and <![CDATA[alarmTime >= #fromTime#]]>

</select >

摘自:http://blog.csdn.net/xiaomuyuliu/article/details/6101985
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: