It's likely that neither a Result Type nor a Result Map was specified

2017-08-29 14:30:49,951 [http-bio-8888-exec-2] ERROR [core.security.process.exception.ExceptionResolverCustom] - nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘StudentMapper.count‘.  It‘s likely that neither a Result Type nor a Result Map was specified.
  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 ‘StudentMapper.count‘.  It‘s likely that neither a Result Type nor a Result Map was specified.
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
    at core.util.CustomSqlSessionTemplate$SqlSessionInterceptor.invoke(CustomSqlSessionTemplate.java:316)
    at com.sun.proxy.$Proxy85.selectOne(Unknown Source)
    at core.util.CustomSqlSessionTemplate.selectOne(CustomSqlSessionTemplate.java:121)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘StudentMapper.count‘.  It‘s likely that neither a Result Type nor a Result Map was specified.
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.validateResultMapsCount(FastResultSetHandler.java:182)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:155)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)

2、错误原因

<select id="count" parameterType="student">
         select count(*) from t_student_info
</select>

Mybatis配置文件中没有返回类型参数

3、解决办法

添加resultType参数值

<select id="count" parameterType="student" resultType="count">
         select count(*) from t_student_info
 </select>

It's likely that neither a Result Type nor a Result Map was specified

原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/12616973.html

时间: 2024-10-04 01:41:56

It's likely that neither a Result Type nor a Result Map was specified的相关文章

A query was run and no Result Maps were found for the Mapped Statement &#39;user.insertUser!selectKey&#39;. It&#39;s likely that neither a Result Type nor a Result Map was specified.

使用mybatis时出现异常问题: 有如下的错误 1 Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'user.insertUser!selectKey'. It's likely that neither a Result Type nor a

ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.win.mall.dao.CartMapper.test’. It’s likely that neither a Result Type nor a Result Map was specified.

ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.win.mall.dao.CartMapper.test'. It's likely that neither a Result Type nor a Result Map was specified. 原因:mybatis没有resultMap报错 在mapper文件的 select 标签中没有指定 res

Scala:Method 小技巧,忽略result type之后的等号

1 var x = 0 2 3 def IncreaseOne(): Int = { 4 x += 1 5 x 6 } 7 8 def IncreaseOne() = { 9 x += 1 10 x 11 } 12 13 def IncreaseOne = { 14 x += 1 15 x 16 } 17 18 19 def IncreaseOne(): Unit = { 20 x += 1 21 x 22 } 23 24 def IncreaseOne() { 25 x += 1 26 x 2

result type struts2标签

<result type=""></result> type属性的值共有10个: <result-types> <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/> <result-type name="dispatcher" class="org.apache.

Struts2 中result type属性说明

Struts2 中result type属性说明 首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/><result-type name="dispatcher" class="org.apac

struts2.xml 中result type属性说明

chain           用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息.           com.opensymphony.xwork2.ActionChainResult       dispatcher           用来转向页面,通常处理JSP           org.apache.struts2.dispatcher.ServletDispatcherResult       freemaker           处理Fr

struts2 result type=(chain、dispatcher、redirect、redirect-action)

(1)type="dispatcher" 为默认,用于jsp页面跳转 <result name="success">/index.jsp</result>  完整的写法为: <result name="success" type="dispatcher">       <param name="location">/index.jsp</param>

The cast to value type &#39;System.Decimal&#39; failed because the materialized value is null. Either the result type&#39;s generic parameter or the query must use a nullable type.

CurrentStock = db.BillEntry.Where(b => b.GoodsId == item.GoodsId).Sum(b => (decimal?)b.Qty) ?? 0, 出现这种错误是因为没有获取到数据造成的,可以使用三元判断来操作,注意Sum里的Qty应该可以为空,如果为空则返回0,否则正式返回. The cast to value type 'System.Decimal' failed because the materialized value is null

【strust】strust.xml中&lt;result type=&quot;&quot;&gt;所有类型详解

在默认时,<result>标签的type属性值是“dispatcher”(实际上就是转发,forward).开发人员可以根据自己的需要指定不同的类型,如redirect.stream等.如下面代码所示: <result name="save" type="redirect"> /result.jsp </result> 这时result-type可以在struts2-core-2.0.11.1.jar包或struts2源代码中的s