码上敲享录 > mybatis的常见问题 > Could not find value method on SQL annotation.Cause: org.xml.sax.SAXParseException

Could not find value method on SQL annotation.Cause: org.xml.sax.SAXParseException

上一章章节目录下一章 2019-08-23已有5749人阅读 评论(0)

报错内容:

org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; The content of elements must consist of well-formed character data or markup.


报错sql语句:

SELECT DISTINCT patients.p_sid,checkinfo.c_jh_flag,checkinfo.c_sample_hg,checkinfo.c_card_no,wcjgs = (select count(*) from checkinfo c where c.c_sid = checkinfo.c_sidand isnull(c.c_flag,0) = 0) FROM  patients inner join checkinfo on

patients.p_id = checkinfo.c_p_id and

isnull(checkinfo.c_sample_type,0) = 1 and

isnull(checkinfo.c_type,0) = 1 and isnull(patients.p_type,1) = 1

and checkinfo.c_sid not in (select dj_min_sid from sampledjmx where dj_xm_sum = -1)  

and checkinfo.c_sid not in (select s_sy_sid from bhgbbdj where isnull(s_sy_sid,'') <>'');


解决方法:把上面 的 < 换成转义字符 &lt; 、> 换成转义字符 &gt;,或者把<>(不等于)改用 !=

本人项目使用的是mybatis的注解方式开发,如果sql加上script标签,代表该条sql以xml解析的方式解析映射,xml解析方式,< 或者 > 应该都用转义字符。


常用的一些需要转义的特殊字符:
&lt;    <     小于号    
<= 和&lt;=的表示是一个意思
&gt;    >     大于号

&amp;    &     和

&apos;    ’     单引号

&quot;    "     双引号





向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
1

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交