title: Olingo v2 - How to write an entity with navigation entities
body: <p>I use Apache Olingo v2. SAP is the server and I'm in charge of the client-side.
  I try to write an entity with navigation entities. I explain what I try to say.
  There is an entity set named HUIDENT, this set contains a navigation property named ToHuContent.</p>
  
  <pre><code>&lt;EntityType Name="HUIDENT" sap:content-version="1"&gt;
    &lt;Key&gt;
      &lt;PropertyRef Name="Lgnum"/&gt;
      &lt;PropertyRef Name="Huident"/&gt;
    &lt;/Key&gt;
    &lt;Property Name="Lgnum" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Numéro magasin" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Huident" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Unité manutent." sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;NavigationProperty Name="ToHuContent" Relationship="SERVICE_HU_CONTENT_SRV.Assoc_Hu_Content" FromRole="FromRole_Assoc_Hu_Content" ToRole="ToRole_Assoc_Hu_Content"/&gt;
  &lt;/EntityType&gt;
  </code></pre>
  
  <p>And a HUCONTENT is</p>
  
  <pre><code>&lt;EntityType Name="HUCONTENT" sap:content-version="1"&gt;
    &lt;Key&gt;
      &lt;PropertyRef Name="Lgnum"/&gt;
      &lt;PropertyRef Name="Huident"/&gt;
    &lt;/Key&gt;
    &lt;Property Name="Lgnum" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Numéro magasin" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Huident" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Unité manutent." sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Matnr" Type="Edm.String" Nullable="false" MaxLength="40" sap:label="Produit" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Ean11" Type="Edm.String" Nullable="false" MaxLength="18" sap:label="Code EAN/UPC" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Batchid" Type="Edm.Binary" Nullable="false" sap:label="Lot" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Quan" Type="Edm.Decimal" Nullable="false" Precision="31" Scale="14" sap:unit="Unit" sap:label="Quantité" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Unit" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Unité" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" sap:semantics="unit-of-measure"/&gt;
    &lt;Property Name="Maktx" Type="Edm.String" Nullable="false" MaxLength="40" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;Property Name="Brand" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Brand" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/&gt;
    &lt;NavigationProperty Name="ToHuIdent" Relationship="SERVICE_HU_CONTENT_SRV.Assoc_Hu_Content" FromRole="ToRole_Assoc_Hu_Content" ToRole="FromRole_Assoc_Hu_Content"/&gt;
  &lt;/EntityType&gt;
  </code></pre>
  
  <p>I would like to send an HUIDENT with some HUCONTENT but I don't how to do this.
  I would like a feed like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;entry xml:base="secretUrl" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;
     &lt;id&gt;secretUrl/HUIDENTSet(Lgnum='IN01',Huident='155000000000001757')&lt;/id&gt;
     &lt;title type="text"&gt;HUIDENTSet(Lgnum='IN01',Huident='155000000000001757')&lt;/title&gt;
     &lt;updated&gt;2016-05-26T22:48:07Z&lt;/updated&gt;
     &lt;category term="SERVICE.HUIDENT" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/&gt;
     &lt;link href="HUIDENTSet(Lgnum='IN01',Huident='155000000000001757')" rel="self" title="HUIDENT"/&gt;
     &lt;link href="HUIDENTSet(Lgnum='IN01',Huident='155000000000001757')/ToHuContent" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ToHuContent" type="application/atom+xml;type=feed" title="ToHuContent"&gt;
      &lt;m:inline&gt;
   &lt;feed xml:base="secretUrl/SERVICE/"&gt;
   &lt;entry&gt;
    &lt;content type="application/xml"&gt;
      &lt;m:properties&gt;
       &lt;d:Lgnum&gt;IN01&lt;/d:Lgnum&gt;
       &lt;d:Huident&gt;155000000000001757&lt;/d:Huident&gt;
       &lt;d:Epc&gt;12345&lt;/d:Epc&gt;
       &lt;d:Matnr&gt;1543473&lt;/d:Matnr&gt;
       &lt;d:Ean&gt;122333&lt;/d:Ean&gt;
       &lt;d:Expiration_date&gt;2016-05-27T00:00:00&lt;/d:Expiration_date&gt;
       &lt;d:CRreatedAt&gt;2016-05-26T22:48:00&lt;/d:CRreatedAt&gt;
      &lt;/m:properties&gt;
     &lt;/content&gt;
    &lt;/entry&gt;
    &lt;entry&gt;
     &lt;content type="application/xml"&gt;
      &lt;m:properties&gt;
       &lt;d:Lgnum&gt;IN01&lt;/d:Lgnum&gt;
       &lt;d:Huident&gt;155000000000001757&lt;/d:Huident&gt;
       &lt;d:Epc&gt;12345&lt;/d:Epc&gt;
       &lt;d:RfidStatus/&gt;
       &lt;d:Matnr&gt;1543473&lt;/d:Matnr&gt;
       &lt;d:Expiration_date&gt;2016-05-27T00:00:00&lt;/d:Expiration_date&gt;
       &lt;d:CRreatedAt&gt;2016-05-26T22:48:00&lt;/d:CRreatedAt&gt;
      &lt;/m:properties&gt;
     &lt;/content&gt;
    &lt;/entry&gt;
   &lt;/feed&gt;
   &lt;/m:inline&gt;
   &lt;/link&gt;
   &lt;content type="application/xml"&gt;
     &lt;m:properties&gt;
       &lt;d:Lgnum&gt;IN01&lt;/d:Lgnum&gt;
       &lt;d:Huident&gt;155000000000001757&lt;/d:Huident&gt;
     &lt;/m:properties&gt;
   &lt;/content&gt;
   &lt;/entry&gt;
  </code></pre>
  
  <p>Using Olingo I've something as</p>
  
  <pre><code>final EntityProviderWriteProperties properties = EntityProviderWriteProperties
                      .serviceRoot(new URI(this.serviceRoot + "/"))
                      .build();
  
  final ODataResponse response = EntityProvider.writeEntry("application/xml", entitySet, new ImmutableMap.Builder&lt;String, Object&gt;()
                 .put("Lgnum", "IN01")
                 .put("Huident", "1")
                 .build(), properties);
  </code></pre>
  
  <p>And I don't know where I can set the HUCONTENT entities.</p>