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

Posted dxj1016

tags:

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

错误sql:

<select id="selectUserName">
    select USER_NAME as userName
    from user
    where 1=1 and
    USER_ID=#userId
</select

正确sql:

<select id="selectUserName" resultType="map">
    select USER_NAME as userName
    from user
    where 1=1 and
    USER_ID=#userId
</select

原因:没有设置resultType,如果resultType="",会导致启动不了后端

MyBatis查询都需要设置返回的resultTyper或者resultMap,否则会出现以上错误。

以上是关于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 StatementProperty [login_ip(代

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...原来是mapper.xml文件出了问题,是使用MyBatis最常见的一种错误

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

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