提问人:SOJSON用户
提问日期:2019-10-10 11:16
热度:2524
Springboot JPA ID 自动生成策略注解uuid和自动递增怎么配置?如何配置数据库id自动递增和uuid?
1条回答
我来回答
soゝso|
2019-10-10 11:18
Springboot jap 实体ID配置 UUID策略
@Id
@Column(name = "id", columnDefinition = "char(32) comment '主键'")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@GeneratedValue(generator = "paymentableGenerator")
Springboot jpa 实体自增ID配置策略
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Integer id;