Skip to content

Commit 48fa03f

Browse files
committed
HHH-18377 Fixed bug with sequence resetting
1 parent eb03db7 commit 48fa03f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public UUID generateUuid(SharedSessionContractImplementor session) {
9898
private long getSequence(final long currentTimestamp) {
9999
lock.lock();
100100
try {
101-
if ( this.currentTimestamp > currentTimestamp ) {
101+
if ( this.currentTimestamp < currentTimestamp ) {
102102
this.currentTimestamp = currentTimestamp;
103-
clockSequence.set( 0 );
103+
clockSequence.updateAndGet( l -> l & 0x1FFFL );
104104
}
105105
}
106106
finally {

0 commit comments

Comments
 (0)