airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch develop updated: AIRAVATA-2876 Fix orphanRemoval on App Deployment
Date Wed, 12 Sep 2018 15:06:18 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8c513fb  AIRAVATA-2876 Fix orphanRemoval on App Deployment
8c513fb is described below

commit 8c513fb8c8d1c0b986f27fae6ec7e1c6e18dfa4e
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Wed Sep 12 10:55:44 2018 -0400

    AIRAVATA-2876 Fix orphanRemoval on App Deployment
    
    OpenJPA needs to know about the ON DELETE CASCADE of the child tables of
    APPLICATION_DEPLOYMENT otherwise it throws an OptimisticLockException.
---
 .../registry/core/entities/appcatalog/AppEnvironmentEntity.java       | 4 ++++
 .../registry/core/entities/appcatalog/LibraryApendPathEntity.java     | 4 ++++
 .../registry/core/entities/appcatalog/LibraryPrependPathEntity.java   | 4 ++++
 .../registry/core/entities/appcatalog/ModuleLoadCmdEntity.java        | 4 ++++
 .../airavata/registry/core/entities/appcatalog/ModuleLoadCmdPK.java   | 2 +-
 .../registry/core/entities/appcatalog/PostjobCommandEntity.java       | 4 ++++
 .../registry/core/entities/appcatalog/PrejobCommandEntity.java        | 4 ++++
 7 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/AppEnvironmentEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/AppEnvironmentEntity.java
index 854064c..597d148 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/AppEnvironmentEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/AppEnvironmentEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -48,6 +51,7 @@ public class AppEnvironmentEntity implements Serializable {
 
     @ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
     @JoinColumn(name = "DEPLOYMENT_ID")
+    @ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
     private ApplicationDeploymentEntity applicationDeployment;
 
     public AppEnvironmentEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryApendPathEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryApendPathEntity.java
index 2b87e8e..35bd448 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryApendPathEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryApendPathEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -46,6 +49,7 @@ public class LibraryApendPathEntity implements Serializable {
 
     @ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
     @JoinColumn(name = "DEPLOYMENT_ID")
+    @ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
     private ApplicationDeploymentEntity applicationDeployment;
 
     public LibraryApendPathEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryPrependPathEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryPrependPathEntity.java
index c015726..f052069 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryPrependPathEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/LibraryPrependPathEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -47,6 +50,7 @@ public class LibraryPrependPathEntity implements Serializable {
 
 	@ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
 	@JoinColumn(name = "DEPLOYMENT_ID")
+	@ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
 	private ApplicationDeploymentEntity applicationDeployment;
 
 	public LibraryPrependPathEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdEntity.java
index 3492445..03edc65 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -45,6 +48,7 @@ public class ModuleLoadCmdEntity implements Serializable {
 
     @ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
     @JoinColumn(name = "APP_DEPLOYMENT_ID")
+    @ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
     private ApplicationDeploymentEntity applicationDeployment;
 
     public ModuleLoadCmdEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdPK.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdPK.java
index 3ab9420..d185885 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdPK.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ModuleLoadCmdPK.java
@@ -55,7 +55,7 @@ public class ModuleLoadCmdPK implements Serializable {
         if (this == other) {
             return true;
         }
-        if (!(other instanceof PostjobCommandPK)) {
+        if (!(other instanceof ModuleLoadCmdPK)) {
             return false;
         }
         ModuleLoadCmdPK castOther = (ModuleLoadCmdPK) other;
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PostjobCommandEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PostjobCommandEntity.java
index ec6f70d..aaddf8b 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PostjobCommandEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PostjobCommandEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -46,6 +49,7 @@ public class PostjobCommandEntity implements Serializable {
 
     @ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
     @JoinColumn(name = "APPDEPLOYMENT_ID")
+    @ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
     private ApplicationDeploymentEntity applicationDeployment;
 
     public PostjobCommandEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PrejobCommandEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PrejobCommandEntity.java
index cd137a2..739ddae 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PrejobCommandEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/PrejobCommandEntity.java
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.registry.core.entities.appcatalog;
 
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openjpa.persistence.jdbc.ForeignKeyAction;
+
 import javax.persistence.*;
 import java.io.Serializable;
 
@@ -46,6 +49,7 @@ public class PrejobCommandEntity implements Serializable {
 
     @ManyToOne(targetEntity = ApplicationDeploymentEntity.class, cascade = CascadeType.MERGE)
     @JoinColumn(name = "APPDEPLOYMENT_ID")
+    @ForeignKey(deleteAction = ForeignKeyAction.CASCADE)
     private ApplicationDeploymentEntity applicationDeployment;
 
     public PrejobCommandEntity() {


Mime
View raw message