Hibernate UUID.hex vs UUID2
I am using hiberate 4.3.5 Final and I see the following warning
org.hibernate.id.UUIDHexGenerator WARN - HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
So, I changed my unique display file id from
generator class = "uuid.hex"
to
generator class = "uuid2"
Coding wise I know this is just a warning, but are there any other advantages of using uuid2 over uuid.hex. Is this a more efficient way or a standard way of using uuid2 or a coding best practice? I am trying to find the best coding practice in my application. Any guru can help me with this?
Another thing I notice is that the uuid2 key has a "-" compared to uuid.hex. Any downside?
source to share
The absence of "-" is the exact difference.
The documentation UUIDHexGenerator
says:
A UUIDGenerator that returns a string of length 32.This string will only be hex digits
And:
Users can also configure it to use a delimiter ("delimiter" configuration option) that separates hexadecimal digits by 8 {sep} 8 {sep} 4 {sep} 8 {sep} 4. Note that this differs from the IETF RFC 4122 submission 8-4-4-4-12.
However, the UUID must have these "-" in certain locations for them to be valid.
source to share