[ 
https://issues.apache.org/jira/browse/OLINGO-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Amend resolved OLINGO-204.
------------------------------------

       Resolution: Not A Problem
    Fix Version/s: V2 1.2.0
         Assignee: Christian Amend

Hi,

Navigation properties are not supported inside a key here the quote from the 
OData specification:
"<Key> describes which <Property> elements form a key that can uniquely 
identify instances of an <EntityType>. Any set of non-nullable, immutable, 
<EDMSimpleType> declared properties can serve as the key."


> EntityType with NavigationProperty Key
> --------------------------------------
>
>                 Key: OLINGO-204
>                 URL: https://issues.apache.org/jira/browse/OLINGO-204
>             Project: Olingo
>          Issue Type: Question
>          Components: odata2-core
>    Affects Versions: V2 1.1.0
>            Reporter: M Carissimi
>            Assignee: Christian Amend
>             Fix For: V2 1.2.0
>
>
> Hello, 
> I have some EntityTypes which define as Key one of the NavigationProperties. 
> For example EntityType AA_SEL_TEST_2 specifies as part of the Key the 
> property OBJECT_REF which is a NavigationProperty for AA_SEL_TEST_1
> {code}
> <EntityType Name="AA_SEL_TEST_2">
> <Key>
> <PropertyRef Name="NAME"/>
> <PropertyRef Name="OBJECT_REF"/>
> </Key>
> <Property Name="GUID" Type="Edm.String" Nullable="false"/>
> <Property Name="NAME" Type="Edm.String" Nullable="false"/>
> <Property Name="FLOW" Type="esys_producer.NumberAndUnits" Nullable="false"/>
> <NavigationProperty Name="OBJECT_REF" 
> Relationship="esys_producer.AA_SEL_TEST_2_to_AA_SEL_TEST_1" 
> FromRole="r_AA_SEL_TEST_2" ToRole="r_AA_SEL_TEST_1"/>
> </EntityType>
> <EntityType Name="AA_SEL_TEST_1">
> <Key>
> <PropertyRef Name="NAME"/>
> <PropertyRef Name="IS_ACTIVE"/>
> <PropertyRef Name="PRODUCTION_DATE"/>
> </Key>
> <Property Name="GUID" Type="Edm.String" Nullable="false"/>
> <Property Name="NAME" Type="Edm.String" Nullable="false"/>
> <Property Name="IS_ACTIVE" Type="Edm.Boolean" Nullable="false"/>
> <Property Name="PRODUCTION_DATE" Type="Edm.DateTime" Nullable="false"/>
> </EntityType>
> {code}
> When I request the feed containing all entries for EntityType AA_SEL_TEST_1 I 
> get all the data, but when I request the feed for entries of type 
> AA_SEL_TEST_2 I get an exception
> {code}
> SEVERE: java.lang.NullPointerException
>       at 
> org.apache.olingo.odata2.core.ep.producer.AtomEntryEntityProducer.createEntryKey(AtomEntryEntityProducer.java:538)
>       at 
> org.apache.olingo.odata2.core.ep.producer.AtomEntryEntityProducer.createSelfLink(AtomEntryEntityProducer.java:524)
>       at 
> org.apache.olingo.odata2.core.ep.producer.AtomEntryEntityProducer.append(AtomEntryEntityProducer.java:99)
>       at 
> org.apache.olingo.odata2.core.ep.producer.AtomFeedProducer.appendEntries(AtomFeedProducer.java:143)
>       at 
> org.apache.olingo.odata2.core.ep.producer.AtomFeedProducer.append(AtomFeedProducer.java:79)
>       at 
> org.apache.olingo.odata2.core.ep.AtomEntityProvider.writeFeed(AtomEntityProvider.java:234)
>       at 
> org.apache.olingo.odata2.core.ep.ProviderFacadeImpl.writeFeed(ProviderFacadeImpl.java:122)
>       at 
> org.apache.olingo.odata2.api.ep.EntityProvider.writeFeed(EntityProvider.java:513)
>       at 
> com.energysys.odata.producer.ResourceEntitySetProcessor.createResponseFeed(ResourceEntitySetProcessor.java:457)
>       at 
> com.energysys.odata.producer.ResourceEntitySetProcessor.readEntitySet(ResourceEntitySetProcessor.java:165)
>       ...
> {code}
> My entity processor class (ResourceEntitySetProcessor) builds a 
> Map<String,Object> containing all the required data and invokes the 
> EntityProvider.writeFeed() method passing the map.
> How can I resolve the issue?
> Regards



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to