我使用我的 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;
它应该是uuid2
:
...
@GenericGenerator(name = "uuid", strategy = "uuid2")
...
See 5.1.2.2.1.各种附加发电机 http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#d0e5294.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)