You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/01/27 20:25:11 UTC

[13/37] olingo-odata2 git commit: [OLINGO-526] Fix for Uni-Directional One to Many relationships

[OLINGO-526] Fix for Uni-Directional One to Many relationships

Signed-off-by: Chandan V A <ch...@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/bd0a1277
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/bd0a1277
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/bd0a1277

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: bd0a12777286d180e182032230cf9f8a5ece6cf4
Parents: 9f39956
Author: Chandan V A <ch...@sap.com>
Authored: Sat Dec 20 09:51:05 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Sat Dec 20 09:51:05 2014 +0530

----------------------------------------------------------------------
 .../odata2/jpa/processor/core/model/JPAEdmProperty.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd0a1277/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index 33f0c93..9bce9fc 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -372,7 +372,14 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
       String[] name = { null, null };
       name[0] = joinColumn.name().equals("") == true ? jpaAttribute.getName() : joinColumn.name();
 
-      EntityType<?> referencedEntityType = metaModel.entity(jpaAttribute.getJavaType());
+      EntityType<?> referencedEntityType = null;
+      if (jpaAttribute.isCollection()) {
+        referencedEntityType =
+            metaModel.entity(((PluralAttribute<?, ?, ?>) currentAttribute).getElementType().getJavaType());
+      } else {
+        referencedEntityType = metaModel.entity(jpaAttribute.getJavaType());
+      }
+
       if (joinColumn.referencedColumnName().equals("")) {
         for (Attribute<?, ?> referencedAttribute : referencedEntityType.getAttributes()) {
           if (referencedAttribute.getPersistentAttributeType() == PersistentAttributeType.BASIC &&