美文网首页MyBatis
A query was run and no Result Ma

A query was run and no Result Ma

作者: EphemeralAurora | 来源:发表于2017-12-02 16:10 被阅读0次

    使用mybatis时出现异常问题:

    有如下的错误

    1Error 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 Result Map was specified.

    这个是使用MyBatis最常见的一种错误,从其描述来看是user.insertUser!selectKey这个Statement没有Result Type或Result Map。下面是我的配置文件的statement:

    123select LAST_INSERT_ID()45insert into user(username,birthday,sex,address) value (#{username},#{birthday},#{sex},#{address});6

    可以看出主要是没有resultType所致的。

    mybatis中不管什么查询,都必须返回resultType或者resultMap的值,否则就会报错的。

    相关文章

      网友评论

        本文标题:A query was run and no Result Ma

        本文链接:https://www.haomeiwen.com/subject/uybnbxtx.html