cancel
Showing results for 
Search instead for 
Did you mean: 

Binding new entities to existing entities via NavigationProperty is not supported

Former Member
0 Kudos

Hi all,

I am trying to insert multiple records using nested json request body but when I am inserting it using POSTMAN I am getting following error

Binding new entities to existing entities via NavigationProperty is not supported

Following are the artifacts that I am using to do so :

service url : http://server:port/logic/odata/person.xsodata/PersonBean   POST

request body :

{

    "PERS_ID": 30,

    "FIRSTNAME": "TstFNameClient",

    "LASTNAME": "TstLNameClient",

    "E_MAIL": "TstemailClient@gmail.com",

    "AddressBean": [

        {

            "ADDRESS_ID": 12,

            "ADDRESS_TEXT1": "tstadd1client",

            "ADDRESS_TEXT2": "tstadd2client",

            "CITY": "tstcityclient",

            "STATE": "tststateclient",

            "COUNTRY": "tstcountryclient",

            "ZIP": "12345",

            "PERS_ID": 30

        }

    ]

}

OData Service code :

service namespace "cust.quote.service" {

  "ZCUSTSEARCH"."TBL_PERSON"

   as "PersonBean"

   navigates ("Address" as "AddressBean");

  "ZCUSTSEARCH"."TBL_ADDRESS"

  as "AddressBean";

  association "Address" principal "PersonBean"("PERS_ID")

  multiplicity "1" dependent "AddressBean"("PERS_ID") multiplicity "*";

}

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello everybody,

are there any news/ideas regarding this one? I recently started working with the hana cloud platform and xsodata services. I am currently at a point where I have a similar entity releationship as stated by dharmesh and similar requirements: I want to insert a record of a type which contains a nested type.

unfortunately, I encounter the same error mentioned in the above posting:

{

  "error": {

    "code": "",

    "message": {

      "lang": "en-US",

      "value": "Error processing request stream. Binding new entities to existing entities via NavigationProperty is not supported. NavigationProperty: foobarB"

    }

  }

}

does anybody have an advice on how to solve this?

thanks in advance,

Jan

Former Member
0 Kudos

Hi Jan,

You can have a look at the following thread to see if it fits your situation: https://scn.sap.com/thread/3604817.

It suggests using the $batch option with your XS OData service to group multiple operations in one request. 

I don't think that we can use associations with the trial version of HANA because it uses a version that doesn't support them yet.

Neal

Former Member
0 Kudos

Hey Neal,

thanks for the reply, that was helpful.

although i was hoping that providing "deep" entities as an input to an odata create service is possible (event if that would force me to create a custom create EXIT).

Inserting deep entities is possible when using odata services which are exposed by netweaver gateway systems. So why does this not apply to an XSOdata service?

thank you and best regards,

jan

Former Member
0 Kudos

Hi,

I am trying to do something similar using a many-to-many association and have run into the same error.  Did you ever find an answer or alternative technique?  I see that this question is over a year old and not answered.

Here is my oData service definition:

service {

  "yyy.zzz.ComplianceTracker.data::ComplianceModel.Resource"

      as "Resources"

      navigates ("ToResourceComplianceRequirements" as "ResourceComplianceRequirements")

      create events(before "yyy.zzz.ComplianceTracker.services:resourceComplianceRequirements.xsjslib::createResourceBeforeExit")

      ;

  "yyy.zzz.ComplianceTracker.data::ComplianceModel.ComplianceRequirement" as "ComplianceRequirements";

  association "ToResourceComplianceRequirements"

  principal "Resources"("ID") multiplicity "*"

  dependent "ComplianceRequirements"("ID") multiplicity "*"

  over "yyy.zzz.ComplianceTracker.data::ComplianceModel.ResourceComplianceRequirement"

  principal ("RESOURCE.ID")

  dependent ("COMPLIANCE_REQUIREMENT.ID");

}

Here is my request payload:

{

  "ID": "0",

  "NAME": "",

  "DESCRIPTION": "",

  "ResourceComplianceRequirements": [{"ID": "1"}]

}

Here is response body:

{

   "error": {

   "code": "",

   "message": {

   "lang": "en-US",

   "value": "Error processing request stream. Binding new entities to existing entities via NavigationProperty is not supported. NavigationProperty: ResourceComplianceRequirements"

   }

   }

}