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 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)