问答详情
源自:2-4 Mybatis自动生成器使用方式

运行时出错

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Dec 18 10:46:47 PST 2018

There was an unexpected error (type=Internal Server Error, status=500).

Invalid bound statement (not found): com.miaoshaproject.dao.UserDOMapper.selectByPrimaryKey


提问者:慕容9033451 2018-12-19 03:03

个回答

  • 雷_煌
    2018-12-20 16:01:22

    配置文件会不会写错了 mybatis.mapper-locations=classpath:mapping/*.xml


  • 叶0528
    2018-12-20 12:05:12

    mybatis-generater.xml中的connectionURL,加参数&nullCatalogMeansCurrent=true:

    然后执行,userDOMapper.xml 里面就会有selectByPrimaryKey

    <!--数据库链接地址账号密码-->

    <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                   connectionURL="jdbc:mysql://localhost:3306/miaosha?useUnicode=true&amp;characterEncoding=utf8&amp;serverTimezone=GMT&amp;nullCatalogMeansCurrent=true"
                   userId="root"
                   password="root">
    </jdbcConnection>


  • liujie151376
    2018-12-20 09:56:06

    那你看下 USERDOMapper.xml 里面的 namespace 是不是写错了

  • liujie151376
    2018-12-19 09:34:28

    userDOMapper.xml 里面没有 selectByPrimaryKey