[ 
https://issues.apache.org/jira/browse/OLINGO-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13755064#comment-13755064
 ] 

Carl J. Mosca commented on OLINGO-11:
-------------------------------------

This may be an oversimplification of the issue but I have made the following 
change to 
org.apache.olingo.odata2.processor.core.jpa.access.data.JPAExpandCallBack.

I assume there are other implications but finding none presently I think it 
will help me learn the codebase.

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -20,9 +20,11 @@
 
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.olingo.odata2.api.ODataCallback;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
@@ -98,8 +100,15 @@
     List<EdmNavigationProperty> currentNavPropertyList = null;
     EdmNavigationProperty currentNavigationProperty = 
context.getNavigationProperty();
     try {
-      @SuppressWarnings({ "unchecked" })
-      List<Object> listOfItems = (List<Object>) 
inlinedEntry.get(context.getNavigationProperty().getName());
+            @SuppressWarnings({"unchecked"})
+            List<Object> listOfItems = new ArrayList<Object>(0);
+            if (inlinedEntry.get(context.getNavigationProperty().getName()) 
instanceof List) {
+                listOfItems = (List<Object>) 
inlinedEntry.get(context.getNavigationProperty().getName());
+            } else if 
(inlinedEntry.get(context.getNavigationProperty().getName()) instanceof 
Collection) {
+                listOfItems.addAll((Collection<Object>) 
inlinedEntry.get(context.getNavigationProperty().getName()));
+            } else if 
(inlinedEntry.get(context.getNavigationProperty().getName()) instanceof Set) {
+                listOfItems.addAll((Set) 
inlinedEntry.get(context.getNavigationProperty().getName()));
+            }
       if (nextEntitySet == null) {
         nextEntitySet = 
context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
       }
@@ -121,9 +130,7 @@
       }
       result.setInlineProperties(getInlineEntityProviderProperties(context));
     } catch (EdmException e) {
-
     } catch (ODataJPARuntimeException e) {
-
     }
     return result;
   }

                
> JPA support for Collection and Set
> ----------------------------------
>
>                 Key: OLINGO-11
>                 URL: https://issues.apache.org/jira/browse/OLINGO-11
>             Project: Olingo
>          Issue Type: Improvement
>          Components: odata2-jpa
>    Affects Versions: 1.0.0
>            Reporter: Carl J. Mosca
>            Assignee: Chandan V.A
>            Priority: Blocker
>              Labels: char, features
>
> It seems that only the List is currently supported for JPA relationships.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to