我使用我的uuid如下:
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
@Column(name = "uuid", unique = true)
private String uuid;
但是我收到了一个聪明的Hibernate警告:
使用org.hibernate.id.UUIDHexGenerator不会生成符合IETF RFC 4122的UUID值;考虑改用org.hibernate.id.UUIDGenerator
所以我想切换到org.hibernate.id.UUIDGenerator
,现在我的问题是如何将其告知Hibernate的生成器。我看到有人用它作为“休眠-uuid”-这就是我尝试过的方法,但结果是负面的:
@Id
@GeneratedValue(generator = "hibernate-uuid")
@GenericGenerator(name = "hibernate-uuid", strategy = "hibernate-uuid")
@Column(name = "uuid", unique = true)
private String uuid;