Skip to content

Commit 5e24fd4

Browse files
committed
HHH-19935 Make sure that increment to current sequence can not be zero
1 parent 014d311 commit 5e24fd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hibernate-core/src/main/java/org/hibernate/id/uuid/UuidVersion7Strategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public State getNextState() {
6464
return new State( now, randomSequence() );
6565
}
6666
else {
67-
final long nextSequence = lastSequence + Holder.numberGenerator.nextLong( 0xFFFF_FFFFL );
67+
final long nextSequence = lastSequence + Holder.numberGenerator.nextLong( 0xFFFF_FFFEL ) + 1;
6868
return nextSequence > MAX_RANDOM_SEQUENCE
6969
? new State( lastTimestamp.plusNanos( 250 ), randomSequence() )
7070
: new State( lastTimestamp, nextSequence );

0 commit comments

Comments
 (0)