MyBatis Generator无法生成selectByPrimaryKey(),updateByPrimaryKey()的解决方法

故障

MyBatis Generator版本:1.3.5


MyBatis Generator在Mapper接口中(由javaClientGenerator生成),只生成了:
deleteByPrimaryKey()
insert()
insertSelective()


未能生成以下方法:
selectByPrimaryKey()
updateByPrimaryKey()
updateByPrimaryKeySelective()


原因

目前测试:当MySQL的表中只有一列(该列为主键)时,会出现这种情况。
可能是MyBatis Generator的BUG。


解决方法

给该表增加一列(非主键)即可。

之后发现我的数据库表果然没有主键。

参考文章:https://blog.csdn.net/winx_coder/article/details/54671650

猜你喜欢

转载自blog.csdn.net/qq_34178998/article/details/80799802