abel533 / MyBatis-Spring-Boot

Spring Boot集成MyBatis的基础项目
3.37k stars 1.59k forks source link

使用通用的mapper 中的insertUseGeneratedKeys方法始终拿不到返回的主键? #134

Closed ernestfei-zhou closed 6 years ago

ernestfei-zhou commented 6 years ago

我在使用通用的mapper 中的insertUseGeneratedKeys方法始终拿不到返回的主键,得到的实体类中的自增主键一直未null,始终拿不到?是怎么回事?基本的错误我都已经排查过了。我用的是mysql数据库,大神能否给出一些拿不到主键的原因?

abel533 commented 6 years ago

这个方法要求主键名字是 id,并且自增。

ernestfei-zhou commented 6 years ago

好的,大神,感觉活跃度不够高呀!