diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index 388378d..cf1ce6c 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -47,6 +47,11 @@
spring-tx
6.1.3
+
+ org.springframework
+ spring-orm
+ 6.1.10
+
org.springframework.retry
spring-retry
diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/deployment/DeploymentService.java b/spring-boot/src/main/java/io/vanillabp/camunda8/deployment/DeploymentService.java
index 991ebe4..fee3174 100644
--- a/spring-boot/src/main/java/io/vanillabp/camunda8/deployment/DeploymentService.java
+++ b/spring-boot/src/main/java/io/vanillabp/camunda8/deployment/DeploymentService.java
@@ -7,6 +7,7 @@
import java.time.OffsetDateTime;
import java.util.List;
import org.springframework.dao.OptimisticLockingFailureException;
+import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
@@ -30,7 +31,7 @@ public DeploymentService(
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Retryable(
- retryFor = OptimisticLockingFailureException.class,
+ retryFor = { OptimisticLockingFailureException.class, ObjectOptimisticLockingFailureException.class },
maxAttempts = 100,
backoff = @Backoff(delay = 100, maxDelay = 500))
public DeployedBpmn addBpmn(
@@ -62,16 +63,37 @@ public DeployedBpmn recoverAddBpmn(
final int fileId,
final String resourceName) {
+ return recoverAddBpmn(exception, model, fileId, resourceName);
+
+ }
+
+ @Recover
+ public DeployedBpmn recoverAddBpmn(
+ final ObjectOptimisticLockingFailureException exception,
+ final BpmnModelInstance model,
+ final int fileId,
+ final String resourceName) {
+
+ return recoverAddBpmn(exception, model, fileId, resourceName);
+
+ }
+
+ private DeployedBpmn recoverAddBpmn(
+ final Exception exception,
+ final BpmnModelInstance model,
+ final int fileId,
+ final String resourceName) {
+
throw new RuntimeException(
"Could not save BPMN '"
- + resourceName
- + "' in local DB due to stale OptimisticLockingFailureException", exception);
+ + resourceName
+ + "' in local DB due to stale OptimisticLockingFailureException", exception);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Retryable(
- retryFor = OptimisticLockingFailureException.class,
+ retryFor = { OptimisticLockingFailureException.class, ObjectOptimisticLockingFailureException.class },
maxAttempts = 100,
backoff = @Backoff(delay = 100, maxDelay = 500))
public DeployedProcess addProcess(
@@ -107,6 +129,27 @@ public DeployedProcess recoverAddProcess(
final Process camunda8DeployedProcess,
final DeployedBpmn bpmn) {
+ return recoverAddProcess(exception, packageId, camunda8DeployedProcess, bpmn);
+
+ }
+
+ @Recover
+ public DeployedProcess recoverAddProcess(
+ final ObjectOptimisticLockingFailureException exception,
+ final int packageId,
+ final Process camunda8DeployedProcess,
+ final DeployedBpmn bpmn) {
+
+ return recoverAddProcess(exception, packageId, camunda8DeployedProcess, bpmn);
+
+ }
+
+ private DeployedProcess recoverAddProcess(
+ final Exception exception,
+ final int packageId,
+ final Process camunda8DeployedProcess,
+ final DeployedBpmn bpmn) {
+
throw new RuntimeException(
"Could not save Process '"
+ camunda8DeployedProcess.getBpmnProcessId()