• 解决Mybatis 异常:A query was run and no Result Maps were found for the Mapped Statement 'xingzhi.dao.music.ISong.GetSongTotal'


    在Java项目中,Mybatis采用配置文件方式进行数据库ORM映射时,偶尔就会出现这么一个异常:

    A query was run and no Result Maps were found for the Mapped Statement 'xingzhi.dao.music.ISong.GetSongTotal'.  It's likely that neither a Result Type nor a Result Map was specified.

    起初并未注意过,每次当都配置好后,再将每个细节检查一遍并修正后,这个错误自动就消失了。

    今天,再次出现时,特意看了一下异常详细信息后才知道原来是在告诉我们:Mybatis 的配置配置文件中,GetSongTotal 这个方法好像没有指定返回值。

    不难看出,既然是关于返回值的异常,那么肯定就是 select 的方法中,缺少了 resultType 或者 resultMap 这两个返回属性节点,只要按照异常提示加上即可。

    正确的结果如下图:

  • 相关阅读:
    I-Cache和D-cache
    socat使用
    反射
    属性方法
    getitem
    文件打开编辑和函数参数
    python3编码问题个人理解
    正文内容 python3编码问题
    进度条制作
    集合关系
  • 原文地址:https://www.cnblogs.com/mcqueen/p/14260793.html
Copyright © 2020-2023  润新知