首页 > 代码库 > Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values;
Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values;
项目部署,启动过程中有以下警告:
[WARN]: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
查看项目中用户类的主键生成策略:
@GenericGenerator(name = "system-uuid", strategy = "uuid.hex") @Id @GeneratedValue(generator = "system-uuid") @Column(name = "user_id") public String getUserId() { return userId ; }经查询,Hibernate 3.6开始,如果有model的主键有uuid生成,就会报这个错误,采用最新的生成策略,改成下面的就会正常
@Id @Column(length = 32, nullable = false) @GeneratedValue(generator = "uuid2" ) //指定生成器名称 @GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator" ) //生成器名称,uuid生成类
XML配置:
原来的:
<id name="id" type="string"> <column name="ID" length="32" /> <generator class="uuid" /> </id>
现在改变后的:
<id name="id" type="string"> <column name="ID" length="36" /> <generator class="uuid2" /> </id>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。