A query was run and no Result Maps were found for the Mapped Statement

Posted 仰望星空

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A query was run and no Result Maps were found for the Mapped Statement相关的知识,希望对你有一定的参考价值。

mybatis测试方法报错:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.xxx.mapper.ExamReportStuMapper.findReportStuIsNotAuto‘.  It‘s likely that neither a Result Type nor a Result Map was specified.
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:79)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
    at com.sun.proxy.$Proxy96.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231)
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:128)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    at com.sun.proxy.$Proxy155.findReportStuIsNotAuto(Unknown Source)
    at com.xxx.service.ReportManagerHandleService.findReportStuIsNotAuto(ReportManagerHandleService.java:145)
    at com.xxx.service.ReportManagerService.saveReportStuIsAuto(ReportManagerService.java:1134)
    at com.xxx.service.ReportManagerService$$FastClassBySpringCGLIB$$c2c6d683.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
    at com.xxx.service.ReportManagerService$$EnhancerBySpringCGLIB$$194b4ca.saveReportStuIsAuto(<generated>)
    at com.xxx.RegionMapperTest.findTReportsaveReportStuIsAuto(RegionMapperTest.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

报错是由于使用mybatis进行查询时,没有给定resultType值出现的错误。resultType是查询对象的类型。

  <!-- 参数   long testId, int is_auto-->
  <select id="findxxx" parameterType="Map" resultMap="BaseResultMap">
            SELECT id_generator() id,stu_id,test_id,...</select>

 

以上是关于A query was run and no Result Maps were found for the Mapped Statement的主要内容,如果未能解决你的问题,请参考以下文章

A query was run and no Result Maps were found for the Mapped Statement

出错:Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were foun

MyBatis报错:A query was run and no Result Maps were found for the Mapped Statement

MyBatis报错:A query was run and no Result Maps were found for the Mapped Statement

MyBatis报错:A query was run and no Result Maps were found for the Mapped Statement

ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.win.m