码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis 异常: The content of elements must consist of well-formed character data or markup

时间:2015-08-05 20:08:04      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

今天用mybatis弄一个小玩意,发现Mapper中以下语句报错,且会导致Tomcat无法正常启动

<select id="getAmountByTimePeriod"  resultMap="seatHisAmountMap">
        select
        sum(nightFare) as nightAmount ,    sum(fare) as seatAmount ,#{0} as starttime,
        #{1} as endtime
        from nightfare
        where
          endtime >=#{0}
        and
          endtime <=#{1}
    </select>

异常如下:
     SAXParseException: The content of elements must consist of well-formed character data or markup.

百度一下得到一个匪夷所思的答案:

     记住:在ibatis的配置文件中不能出现小于号

抱着试试看的态度试验了一下,代码改为:

<select id="getAmountByTimePeriod"  resultMap="seatHisAmountMap">
        select
        sum(nightFare) as nightAmount ,    sum(fare) as seatAmount ,#{0} as starttime,
        #{1} as endtime
        from nightfare
        where
          endtime >=#{0}
        and
          #{1}>=endtime 
    </select>

问题竟然解决了....

Mybatis 异常: The content of elements must consist of well-formed character data or markup

标签:

原文地址:http://www.cnblogs.com/azhqiang/p/4705566.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!