Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values;
2017-11-07 16:31
1376 查看
项目部署,启动过程中有以下警告:
[WARN]: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
查看项目中用户类的主键生成策略:
[java] view plain copy
@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生成,就会报这个错误,采用最新的生成策略,改成下面的就会正常
[java] view plain copy
@Id
@Column(length = 32, nullable = false)
@GeneratedValue(generator = "uuid2" ) //指定生成器名称
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator" ) //生成器名称,uuid生成类
XML配置:
原来的:
[html] view plain copy
<id name="id" type="string">
<column name="ID" length="32" />
<generator class="uuid" />
</id>
现在改变后的:
[html] view plain copy
<id name="id" type="string">
<column name="ID" length="36" />
<generator class="uuid2" />
</id>
[WARN]: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
查看项目中用户类的主键生成策略:
[java] view plain copy
@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生成,就会报这个错误,采用最新的生成策略,改成下面的就会正常
[java] view plain copy
@Id
@Column(length = 32, nullable = false)
@GeneratedValue(generator = "uuid2" ) //指定生成器名称
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator" ) //生成器名称,uuid生成类
XML配置:
原来的:
[html] view plain copy
<id name="id" type="string">
<column name="ID" length="32" />
<generator class="uuid" />
</id>
现在改变后的:
[html] view plain copy
<id name="id" type="string">
<column name="ID" length="36" />
<generator class="uuid2" />
</id>
相关文章推荐
- 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;
- 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;
- 【hibernate】主键生成策略使用UUID报出如下警告:org.hibernate.id.UUIDHexGenerator - HHH000409: 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 gen
- org.hibernate.MappingException: could not instantiate id generator
- Hibernate中id设置<generator class="uuid.hex" />
- 在Hibernate中配置Hilo进行数据绑定测试时出错:org.hibernate.MappingException: Could not instantiate id generator
- hibernate出现:org.hibernate.PropertyNotFoundException: Could not find a getter for id in class
- org.hibernate.PropertyNotFoundException: Could not find a getter for id in class com.pb.dao.UserDao
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration
- 【bug】org.hibernate.dialect.OracleDialect does not support identity key generation
- org.hibernate.AnnotationException: Unknown Id.generator: Teacher_GEN
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
- WARNING [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [] milliseconds.
- Could not find configuration [org.hibernate.cache.UpdateTimestampsCache]; using defaults
- Hibernate 使用 generator ="uuid"生成id时会报warnning Using org.hibernate.id.UUIDHexGenerator which does no