Repository: olingo-odata2
Updated Branches:
  refs/heads/master 9f39956a3 -> bd0a12777


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

Signed-off-by: Chandan V A <[email protected]>

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/master
Commit: bd0a12777286d180e182032230cf9f8a5ece6cf4
Parents: 9f39956
Author: Chandan V A <[email protected]>
Authored: Sat Dec 20 09:51:05 2014 +0530
Committer: Chandan V A <[email protected]>
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 &&

Reply via email to