JAVA中JPA的主键自增长注解设置 - PC君 - 博客园 (cnblogs.com)
@Entity @Table(name = "download_info") public class DownloadURL { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String name; private String version; private String url;
最好使用GenerationType.IDENTITY而不是GenerationType.AUTO,当然仅限mysql数据库,也仅限数字型id。因为下面这个异常
Hibernate之Table ‘xxx.hibernate_sequence‘ doesn‘t exist异常_
使用了@GeneratedValue(strategy = GenerationType.IDENTITY)id即使为null也可以
标签:String,jpa,递增,private,GenerationType,id,IDENTITY From: https://www.cnblogs.com/wYYBLH/p/16898779.html