File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
hibernate-core/src/main/java/org/hibernate Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 99import java .util .UUID ;
1010
1111import org .hibernate .Incubating ;
12+ import org .hibernate .id .uuid .UuidV6ValueGenerator ;
13+ import org .hibernate .id .uuid .UuidV7ValueGenerator ;
1214import org .hibernate .id .uuid .UuidValueGenerator ;
1315
1416import static java .lang .annotation .ElementType .FIELD ;
@@ -52,7 +54,19 @@ enum Style {
5254 * @implNote Can be a bottleneck, since synchronization is used when
5355 * incrementing an internal counter as part of the algorithm.
5456 */
55- TIME
57+ TIME ,
58+ /**
59+ * Use a time-based generation strategy consistent with RFC 4122
60+ * version 6.
61+ * @see UuidV6ValueGenerator
62+ */
63+ UUIDV6 ,
64+ /**
65+ * Use a time-based generation strategy consistent with RFC 4122
66+ * version 7.
67+ * @see UuidV7ValueGenerator
68+ */
69+ UUIDV7
5670 }
5771
5872 /**
Original file line number Diff line number Diff line change 2323
2424import static org .hibernate .annotations .UuidGenerator .Style .AUTO ;
2525import static org .hibernate .annotations .UuidGenerator .Style .TIME ;
26+ import static org .hibernate .annotations .UuidGenerator .Style .UUIDV6 ;
27+ import static org .hibernate .annotations .UuidGenerator .Style .UUIDV7 ;
2628import static org .hibernate .generator .EventTypeSets .INSERT_ONLY ;
2729import static org .hibernate .internal .util .ReflectHelper .getPropertyType ;
2830
@@ -81,6 +83,12 @@ private static UuidValueGenerator determineValueGenerator(
8183 else if ( config .style () == TIME ) {
8284 return new CustomVersionOneStrategy ();
8385 }
86+ else if ( config .style () == UUIDV6 ) {
87+ return new UuidV6ValueGenerator ();
88+ }
89+ else if ( config .style () == UUIDV7 ) {
90+ return new UuidV7ValueGenerator ();
91+ }
8492 }
8593
8694 return StandardRandomStrategy .INSTANCE ;
You can’t perform that action at this time.
0 commit comments