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

问题:

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 'xxxxxxxxxxxxx'. It's likely that neither a Result Type nor a Result Map was specified.

 

解决方法:

需指定resultType或者resultMap。

举例:

在mapper.xml映射文件中,写了一个select

原来错误写法:

<select id="xxxx">

   select count(*) from xxx where id=#{id} and name=#{name}

</select>

修改后正确写法:

<select id="xxxx" resultType="java.lang.Integer">

    select count(*) from xxx where id=#{id} and name=#{name}

</select>

posted @ 2021-08-03 20:53  咖啡&牛奶  阅读(1526)  评论(1编辑  收藏  举报