Mybatis There is no getter for property报错和解决

逃离我推掉我的手 2023-05-21 08:59 162阅读 0赞

文章目录

    • 报错时间
    • 报错场景
    • 报错代码和错误信息
    • 报错原因
    • 解决方法

报错时间

2020年4月24日11:28:02

报错场景

使用Mybatis向MySQL数据库添加数据

报错代码和错误信息

  1. org.apache.ibatis.exceptions.PersistenceException:
  2. ### Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productid' in 'class cn.yys.mybatis01.Product'
  3. ### The error may exist in ProductMapper.xml
  4. ### The error may involve cn.yys.mybatis01.ProductMapper.addProduct-Inline
  5. ### The error occurred while setting parameters
  6. ### SQL: insert into product(ProductId,ProductName,UnitPrice,UnitsInStock,ProductDesc) values (?,?,?, ?,?)

报错原因

Java实体类和XML映射之间的名字不匹配

解决方法

在这里插入图片描述

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,162人围观)

还没有评论,来说两句吧...

相关阅读