看网上关于这方面错误的是百花齐放

 

我的错误原因是用mybatis-plus根据id删除(deleteById)或更新(updateById)数据时报错

 

注意:id必须为主键

 

我们看mybatis-plus的封装,这里以deleteById为例

There is no getter for property named 'null' in 'class XXX'异常

 

 There is no getter for property named 'null' in 'class XXX'异常

 

 

我们需要在主键字段上面添加 @TableId,这个主键可以是任意字段表示,不一定非要用“id”

There is no getter for property named 'null' in 'class XXX'异常

 

 

只有加了@TableId注释,才可以用类似deleteById的方法,此id即为注释下的字段

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2021-10-03
  • 2021-08-25
  • 2021-11-03
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-04-17
相关资源
相似解决方案