You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "M Carissimi (JIRA)" <ji...@apache.org> on 2014/03/12 10:26:42 UTC

[jira] [Created] (OLINGO-204) EntityType with NavigationProperty Key

M Carissimi created OLINGO-204:
----------------------------------

             Summary: 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


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)