Skip to content

Commit c5fb021

Browse files
authored
Introduces optimistic locking for project aggregate (#1127)
Concurrent modification of projects is now possible due to the introduction of an optimistic locking strategy introducing a version for every row entry for the project aggregate. In case of a concurrent write modification, an exception is thrown and the retry handler of the flux jumps in with the default retry strategy we have currently configured.
1 parent fac2368 commit c5fb021

File tree

1 file changed

+4
-0
lines changed
  • project-management/src/main/java/life/qbic/projectmanagement/domain/model/project

1 file changed

+4
-0
lines changed

project-management/src/main/java/life/qbic/projectmanagement/domain/model/project/Project.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import jakarta.persistence.OneToMany;
1717
import jakarta.persistence.PostLoad;
1818
import jakarta.persistence.Table;
19+
import jakarta.persistence.Version;
1920
import java.time.Instant;
2021
import java.util.ArrayList;
2122
import java.util.List;
@@ -37,6 +38,9 @@ public class Project {
3738
@EmbeddedId
3839
private ProjectId projectId;
3940

41+
@Version
42+
private int version;
43+
4044
@Embedded
4145
private ProjectIntent projectIntent;
4246

0 commit comments

Comments
 (0)