hyanqing1 2011-08-14 14:46
浏览 1588
已采纳

mybatis3出现Could not find SQL statement to include with refid 异常

采用spring3和mybatis3及mybatis-spring整合做了个实例,在做分页的时候,由于要两条SQL语句:一条查询总记录数,一条是查找当前页的数据,所以采用mybatis3中的标签,如:
[code="java"]
student s,classinfo c where s.cid=c.cid

<select id="findCount" resultType="long">
    select count(*) from <include refid="page_where"/>
</select>

<select id="find" resultMap="studentMap">
    select s.sid,s.cid,s.sno,s.sname,s.sex,s.birthday,c.cname from <include refid="page_where"/>
</select>

[/code]
运行就抛出如下错误:
[code="java"]org.apache.ibatis.builder.xml.IncompleteStatementException: Could not find SQL statement to include with refid[/code]
[code="java"]严重: Servlet.service() for servlet SpringMVC threw exception
java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for com.hyq.showcase.mapper.StudentMapper.page_where[/code]
在网上查询,出现错误的答案是ibatis2,是在在 sqlmap-config.xml 中 中添加 useStatementNamespaces="true",而3中是不用的,谢谢各位大侠!

  • 写回答

1条回答

  • myali88 2011-08-14 22:52
    关注

    mybatis 3 具体是什么版本? [url]http://code.google.com/p/mybatis/issues/detail?id=250[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制