Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-52

expand collection issue - Set support

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: V2 1.1.0
    • Fix Version/s: V2 1.1.0
    • Component/s: odata2-jpa
    • Environment:
      Hibernate

      Description

      We have a model which employs Sets. The JPAExpandCallback seems to be expecting Lists for collections.

      The newly discovered "odata-debug" made finding this issue very easy.

      A diff of the code changes for a quick fix are below. Because I ran into this previously elsewhere, I wonder if a cleaner way to handle the collections has already been added somewhere in the code base.

      @@ -100,8 +104,13 @@
      List<EdmNavigationProperty> currentNavPropertyList = null;
      EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
      try {

      • @SuppressWarnings( { "unchecked" }

        )

      • List<Object> listOfItems = (List<Object>) inlinedEntry.get(context.getNavigationProperty().getName());
        + List<Object> listOfItems = null;
        + if (inlinedEntry.get(context.getNavigationProperty().getName()) instanceof Set) { + listOfItems = new ArrayList<Object>(); + listOfItems.addAll((Set) inlinedEntry.get(context.getNavigationProperty().getName())); + }

        else

        { + listOfItems = (List<Object>) inlinedEntry.get(context.getNavigationProperty().getName()); + }

        if (nextEntitySet == null)

        { nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty); }

        Attachments

          Activity

            People

            • Assignee:
              chandan.v.a Chandan V.A
              Reporter:
              carljmosca Carl J. Mosca
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: