MyBatis3: Could not find SQL statement to include with refid ‘
错误:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find SQL statement to include with refid 'cn.mysteel.category.dao.impl.CategoryDaoImpl.category'
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
at com.sun.proxy.$Proxy10.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:237)
at cn.mysteel.common.core.dao.impl.BaseDaoImpl.insert(BaseDaoImpl.java:70)
at cn.mysteel.category.dao.CategoryDAOTest.insertCategory(CategoryDAOTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.ibatis.builder.IncompleteElementException: Could not find SQL statement to include with refid 'cn.mysteel.category.dao.impl.CategoryDaoImpl.category'
at org.apache.ibatis.builder.xml.XMLIncludeTransformer.findSqlFragment(XMLIncludeTransformer.java:62)
at org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:37)
at org.apache.ibatis.builder.xml.XMLIncludeTransformer.applyIncludes(XMLIncludeTransformer.java:50)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:83)
at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:682)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:613)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
... 32 more
Caused by: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for cn.mysteel.category.dao.impl.CategoryDaoImpl.category
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
at org.apache.ibatis.builder.xml.XMLIncludeTransformer.findSqlFragment(XMLIncludeTransformer.java:58)
... 45 more
private Node findSqlFragment(String refid) {
refid = builderAssistant.applyCurrentNamespace(refid, true);
try {
XNode nodeToInclude = configuration.getSqlFragments().get(refid);
Node result = nodeToInclude.getNode().cloneNode(true);
return result;
} catch (IllegalArgumentException e) {
throw new IncompleteElementException("Could not find SQL statement to include with refid '" + refid + "'", e);
}
}
mapper-xml:
<mapper namespace="cn.mysteel.category.dao.impl.CategoryDaoImpl">
<sql id="t_category"> category </sql> --id:别名;标签里面的是表名
<insert id="insert" parameterType="category" keyProperty="id" useGeneratedKeys="true">
insert into <include refid="t_category"/> (name, version, note)
values (#{name}, #{version}, #{note})
</insert>
....
</mapper>
insert的 <include refid="t_category"/>这里配置的不对,即category要是数据库的表,要写对。
可以参考:http://fhd001.iteye.com/blog/1128879
MyBatis3: Could not find SQL statement to include with refid ‘的更多相关文章
- 直接放个DB2 SQL STATEMENT大全好了!
SQL statements This topic contains tables that list the SQL statements classified by type. SQL sch ...
- Which SQL statement is the trump card to the senior software developer
Which SQL statement is the trump card to the senior software developer MA Genfeng ...
- Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one SQL statement
Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and d ...
- java.sql.preparedstatement和java.sql.statement的区别
本文转自CSDN,然后整理了一遍.原文出处:CSDN JDBC(java database connectivity,java数据库连接)的api中的主要的四个类之一的java.sql.stateme ...
- ORA-06550:line 1,column 7;PLS-00201:indentifer '存储过程' must be declared;...PL/SQL Statement ignored 问题
前段时间由于修改SMES系统,出现了一个问题. ORA-06550:line 1,column 7;PLS-00201:indentifer '存储过程' must be declared;...PL ...
- 什么是SQL statement?
什么是SQL statement? 1.SQL SELECT statement - SELECT命令 REFER: What is SQL, and what are some example st ...
- Viewing the Raw SQL Statement(xcode で)
Thanks to Core Data. Even without learning SQL and database, you’re able to perform create, select, ...
- Caused by: org.h2.jdbc.JdbcSQLException: Table "T_STUDENT_INFO" not found; SQL statement
1.错误描述 org.hibernate.exception.SQLGrammarException: error executing work at org.hibernate.exception. ...
- Error 1313: RETURN is only allowed in a FUNCTION SQL Statement
1.错误描述 14:07:26 Apply changes to rand_string Error 1313: RETURN is only allowed in a FUNCTION SQL St ...
随机推荐
- Node_JS
//http://www.nodebeginner.org/index-zh-cn.html#how-our-server-handles-requests 按照这个页面的例子写的,留作笔记//ind ...
- zoj3888 找第二大
题目简化后最终要求的就是第二大的数.但是由于数据较大,不能直接求.可以先预处理,求出所有情况. #include<stdio.h> #include<string.h> #in ...
- Java算法-各种题目总结
1.排列计算 /*[程序1] 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 1.程序分析: 兔子 ...
- FastDFS在centos上的安装配置与使用
FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的在线服务.(百 ...
- PLSQL中配置Oracle方法
在服务器上,用PL/SQL连接Oracle数据库时,出现了一个问题,提示: Initialization error Could not load "F:\oracle\bin\oci.dl ...
- angularjs的页面拆分思想
//app.js angular.module('MyModule', ['SubModule1', 'SubModule2']) .module('SubModule1', ['CommonModu ...
- Code Review Engine Learning
相关学习资料 https://www.owasp.org/index.php/Code_review https://www.owasp.org/images/8/8e/OWASP_Code_Revi ...
- 采用httpclient提交数据到服务器
1)Get提交数据 效果演示:
- 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
一,$.get(url,[data],[callback]) 说明:url为请求地址,data为请求数据的列表(是可选的,也可以将要传的参数写在url里面),callback为请求成功后的回调函数,该 ...
- inux环境PHP7.0安装
inux环境PHP7.0安装 PHP7和HHVM比较PHP7的在真实场景的性能确实已经和HHVM相当, 在一些场景甚至超过了HHVM.HHVM的运维复杂, 是多线程模型, 这就代表着如果一个线程导 ...