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>

Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values;

时间: 2024-10-06 07:08:27

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;

主键生成策略使用UUID报出如警告如下: 控制台- 2017-11-24 18:40:14 [restartedMain] WARN org.hibernate.id.UUIDHexGenerator - HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUI

hibernate ID 生成方式

1.assigned 主键由外部程序负责生成,在 save() 之前必须指定一个.Hibernate不负责维护主键生成.与Hibernate和底层数据库都无关,可以跨数据库.在存储对象前,必须要使用主键的setter方法给主键赋值,至于这个值怎么生成,完全由自己决定,这种方法应该尽量避免. <id name="id" column="id"> <generator class="assigned" /> </id&g

org.hibernate.id.IdentifierGenerationException错误解决方法

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): ID主键生成策略为assigned 由应用程序负责生成主键标识符 <id name="id" type="java.lang.String"> <column name="ID" length=&qu

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save()

org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.zh.hibernate.subclass.Person    at org.hibernate.id.Assigned.generate(Assigned.java:52)    at org.hibernate.event.internal.Abstrac

org.hibernate.id.IdentifierGenerationException: id

Spring mvc 用POI 导入Excel数据的时候提示:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(). 原因:检查之后发现是因为Excel的数据格式不对.应该是文本,但是表格显示数据是常规.所以大家如果有遇到类似的问题要看一下是否是自己要导入的Excel格式不对,

Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.qingmu.seller.entity.OrderMaster

org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.qingmu.seller.entity.OrderMaster; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be m

hibernate ID生成策略配置

1.Student.hbm.xml配置 <hibernate-mapping package="com.wxh.hibernate.model"> <class name="Student" > <id name="id"> <generator class="uuid"></generator> </id> <property name="

hibernate id主键生成策略

数据库的设计和操作中,我们通常会给表建立主键. 主键,可以分为自然主键和代理主键. 自然主键表示:采用具有业务逻辑含义的字段作为表的主键.比如在用户信息表中,采用用户的身份证号码作为主键.但是这样一来,随着业务逻辑的变化,主键就有可能要更改.比如,假设哪天身份证号码升级成19,2位,那....... 代理主键:在表中人为的增加一个字段,该字段并没有表示任何的业务逻辑,仅仅用来标识一行数据.比如说在用户信息表中,增加一个用户ID的字段.用来表示该条用户信息的记录. 通常情况下,用的比较多的是代理主

Hibernate ID生成策略

我们在创建表的时候都有一个唯一id,但是我们想自动的跨平台的生成id,hibernate帮我们实现了方法. 常用的UUID,native: 方式一: 使用xml:Student.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sour