olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chanda...@apache.org
Subject olingo-odata2 git commit: [OLINGO-721] Fix for removing links when default transactions are used
Date Sat, 04 Jul 2015 03:07:54 GMT
Repository: olingo-odata2
Updated Branches:
  refs/heads/master 2b3bce1ea -> 06c5ec322


[OLINGO-721] Fix for removing links when default transactions are used

Signed-off-by: Chandan V A <chandan.v.a@sap.com>

Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/06c5ec32
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/06c5ec32
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/06c5ec32

Branch: refs/heads/master
Commit: 06c5ec322d23bb3d21a57580ae514273ca52addc
Parents: 2b3bce1
Author: Chandan V A <chandan.v.a@sap.com>
Authored: Sat Jul 4 08:33:31 2015 +0530
Committer: Chandan V A <chandan.v.a@sap.com>
Committed: Sat Jul 4 08:34:57 2015 +0530

----------------------------------------------------------------------
 .../odata2/jpa/processor/core/access/data/JPALink.java       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/06c5ec32/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
index 72e32df..dd806a5 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
@@ -123,7 +123,9 @@ public class JPALink {
           condition.append(ODATA_OPERATOR_OR).append(SPACE);
         }
       }
-      options.put(ODATA_COMMAND_FILTER, condition.toString());
+      if (condition.length() > 0) {
+        options.put(ODATA_COMMAND_FILTER, condition.toString());
+      }
 
       UriInfo parsedUriInfo = parser.parseLinkSegments(linkSegments, options);
       List<Object> relatedEntities = jpaProcessor.process((GetEntitySetUriInfo) parsedUriInfo);
@@ -161,7 +163,9 @@ public class JPALink {
     if (targetJPAEntity != null) {
       em.persist(targetJPAEntity);
     }
-    if (isLocalTransaction && (em.contains(sourceJPAEntity) || em.contains(targetJPAEntity)))
{
+    if (isLocalTransaction
+        && ((sourceJPAEntity != null && em.contains(sourceJPAEntity)) ||
(targetJPAEntity != null && em
+            .contains(targetJPAEntity)))) {
       tx.commit();
     }
   }


Mime
View raw message