Project deployment, the following warnings are available during startup:
[WARN]: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; Consider using Org.hibernate.id.UUIDGenerator instead
To view the primary key generation strategy for the user class in your project:
@GenericGenerator (name = "System-uuid", strategy = "Uuid.hex") @Id @generatedvalue (generator = "System-uuid") @Column ( Name = "user_id") public String getUserId () {return userId;}
After the query, Hibernate 3.6, if there is a model of the primary key has the UUID generation, will report this error, using the latest generation strategy, change to the following will be normal
@Id @column (length = +, Nullable = False) @GeneratedValue (generator = "Uuid2") //Specify Generator name @genericgenerator (name = " Uuid2 ", strategy =" org.hibernate.id.UUIDGenerator ") //Generator name, UUID Generation class
XML configuration:
The original:
<id name= "id" type= "string" > <column name= "id" length= "+"/> <generator class= "uuid"/> </id>
Now after the change:
<id name= "id" type= "string" > <column name= "id" length= "$"/> <generator class= "Uuid2"/> </id>