【发布时间】:2011-09-15 10:57:41
【问题描述】:
我正在使用我的 uuid,如下所示:
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
@Column(name = "uuid", unique = true)
private String uuid;
但我收到了智能休眠警告:
使用 org.hibernate.id.UUIDHexGenerator 不生成 IETF RFC 4122 兼容的 UUID 值;考虑使用 org.hibernate.id.UUIDGenerator 代替
所以我想切换到org.hibernate.id.UUIDGenerator,现在我的问题是我应该如何将它告诉 Hibernate 的生成器。我看到有人将它用作“hibernate-uuid” - 所以这是我尝试过的,但结果是否定的:
@Id
@GeneratedValue(generator = "hibernate-uuid")
@GenericGenerator(name = "hibernate-uuid", strategy = "hibernate-uuid")
@Column(name = "uuid", unique = true)
private String uuid;
【问题讨论】:
标签: java hibernate annotations uuid