@Id
@Column(name = "id")
@GeneratedValue(generator="JDBC")
private Integer id;
使用数据库为mysql,依赖引入正确,配置也正确,就是插入语句时无法获得id,反复检查依赖、配置和官网的比对,没问题。最后发现时数据库建表时,id没有设置为自增。
改成自增即可
@Id
@Column(name = "id")
@GeneratedValue(generator="JDBC")
private Integer id;
使用数据库为mysql,依赖引入正确,配置也正确,就是插入语句时无法获得id,反复检查依赖、配置和官网的比对,没问题。最后发现时数据库建表时,id没有设置为自增。
改成自增即可
转载于:https://www.cnblogs.com/hhan/p/10757115.html