You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Yaofeng Xu (JIRA)" <ji...@apache.org> on 2014/12/05 16:59:14 UTC

[jira] [Commented] (OLINGO-508) One-to-Many self-link causing NotImplementedException

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

Yaofeng Xu commented on OLINGO-508:
-----------------------------------

I don't have suggestion for a quick fix. A possible workaround is to not use EdmNavigationProperty.getMulticity(). Instead, get the java type of the navigation property field, then decide isFeed according if the type is instanceof List. However, the right solution I think is to set a different toRole when building a NavigationProperty which has a relationship pointing to the same entity.

> One-to-Many self-link causing NotImplementedException
> -----------------------------------------------------
>
>                 Key: OLINGO-508
>                 URL: https://issues.apache.org/jira/browse/OLINGO-508
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core
>    Affects Versions: V2 0.0.0
>            Reporter: Yaofeng Xu
>
> An exception will be thrown when expanding an inline entity which is a one-to-many relationship to the entity itself.
> My entity model:
> @EdmEntityType
> @EdmEntitySet(name="Manufacturers")
> public class Manufacturer {
>        @EdmKey
>        @EdmProperty
>        private String id;
>        @EdmProperty
>        private String name;
>        @EdmProperty
>        private Calendar founded;
>        @EdmNavigationProperty
>        private List<Car> cars;
>        @EdmNavigationProperty
>        private List<Manufacturer> subManufacturers;
>        
> }
> Request:  http://localhost:8080/PqmODataExample/PqmODataExample.svc/Manufacturers('1')?$expand=SubManufacturers
> Response:
> {"error":{"code":null,"message":{"lang":"en","value":"Not implemented"}}}
> A workaround is to add toRole to the navigation property annotation as "@EdmNavigationProperty(toRole="r-manufacturers")".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)