OData4j - Does OData4j support Deep Insert

123 views
Skip to first unread message

Gowthami Agumamidi

unread,
Mar 5, 2014, 6:52:37 AM3/5/14
to odata4j...@googlegroups.com
I have a usecase where I need to POST a hierarchial structure.
I have a header and associations to multiple items. The OData service is implemented to deep insert both header and related items together.
Could someone provide me a sample java code on how this can be achieved using Odata4j APIs.

Sample OData:
   <a:author>
      <a:name />
   </a:author>
   <a:category term="HEADERSet" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
   <a:content type="application/xml">
      <m:properties>
         <d:id />
         <d:type>TEST</d:Formtype>
      </m:properties>
   </a:content>
   <a:link href="" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ITEMSet" type="application/atom+xml;type=feed">
      <m:inline>
         <a:feed>
            <a:entry>
               <a:author>
                  <a:name />
               </a:author>
               <a:content type="application/xml">
                  <m:properties>
                     <d:Key>first_name</d:Key>
                     <d:Value>A</d:Value>
                  </m:properties>
               </a:content>
            </a:entry>
           </a:feed>
      </m:inline>
   </a:link>
</a:entry>

Marek Czarnecki

unread,
Apr 15, 2015, 1:14:30 AM4/15/15
to odata4j...@googlegroups.com
Just found the solution (after extensive random searching)

Use OCreateRequest.inline()

Search the tests for class CreateTest

Works beautifully.
Message has been deleted

Dhaval Pandya

unread,
May 15, 2015, 9:45:34 AM5/15/15
to odata4j...@googlegroups.com
Hi, Marek.

I actually need a bit of more assistance. Would you be able to provide me a working solution for this issue?
I've been pulling my hair out since last two days because of this.
My unfamiliarity with odata and this library has rendered my efforts less effective.

Regards,
Dhaval.
Reply all
Reply to author
Forward
0 new messages