代码改变世界

mybatis报错错误It's likely that neither a Result Type nor a Result Map was specified

2020-06-12 22:19  lightliliang  阅读(1367)  评论(0)    收藏  举报

1、错误描述

 2019-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.

 

2、错误原因

<select id="findQuerVo" parameterType="com.itheima.domain.QueryVo" >
        select * from user where username like #{user.username}
</select>

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

3、解决办法

     添加resultType参数值

<select id="findQuerVo" parameterType="com.itheima.domain.QueryVo" resultType="com.itheima.domain.User" >
        select * from user where username like #{user.username}
</select>