Class UuidVersion7Strategy

java.lang.Object
org.hibernate.id.uuid.UuidVersion7Strategy
All Implemented Interfaces:
Serializable, UuidValueGenerator, UUIDGenerationStrategy

public class UuidVersion7Strategy extends Object implements UUIDGenerationStrategy, UuidValueGenerator
Implements UUID Version 7 generation strategy as defined by the RFC 9562.
  • 48 bits - 48-bit big-endian unsigned number of the Unix Epoch timestamp in milliseconds.
  • 4 bits - version field, set to 0b0111 (7).
  • 12 bits - sub-milliseconds part of timestamp (resolution approximately 1/4 of millisecond) to guarantee additional monotonicity.
  • 2 bits - variant field, set to 0b10.
  • 14 bits - counter to guarantee additional monotonicity, resets to 0 when timestamp changes.
  • 48 bits - pseudorandom data to provide uniqueness.
See Also:
API Note:
Version 7 features a time-ordered value field derived from the widely implemented and well-known Unix Epoch timestamp source, the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded.