Hiberante+jpa,注解生成32字符的Id

时间:2024-12-10 19:07:38
@Id
@GenericGenerator(name = "id-generator", strategy = "uuid")
@GeneratedValue(generator = "id-generator",strategy = GenerationType.IDENTITY)
private String id;

  或者

@Id
@GenericGenerator(name = "id-generator", strategy = "uuid")
@GeneratedValue(generator = "id-generator",strategy = GenerationType.IDENTITY)
private String id;