OData v4: Change the Reference in a Single-Valued Navigation Property
See original GitHub issueHow am I supposed to change a reference in a single-valued navigation property using the UI5 OData v4 Model? The OData documentation states that this could be accomplished by following request:
PUT serviceRoot/People('russellwhyte')/Trips(1001)/PlanItems(11)/Microsoft.OData.SampleService.Models.TripPin.Flight/Airline/$ref
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json
{
"@odata.id": "serviceRoot/Airlines('FM')"
}
But I cannot find a way to achieve this by using the UI5 classes in sap.ui.model.odata.v4. Am I missing something? If I try to change the value of the navigation property via the setProperty method of sap.ui.model.odata.v4.Context I get an error that states that $ref is not a (navigation) property. Besides that the setProperty method only allows primitive values.
Any kind of help is much appreciated.
Greetings Marvin
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Change the Reference in a Single-Valued Navigation ...
How am I supposed to change a reference in a single-valued navigation property using the UI5 OData v4 Model? The OData documentation states ......
Read more >OData Version 4.01. Part 1: Protocol - OASIS Open
Relationships from one entity to another are represented as navigation properties. Navigation properties are generally defined as part of an entity type, ...
Read more >Basic Tutorial · OData - the Best Way to REST
A successful PUT request to a single-valued navigation property's reference resource changes the related entity. The request below change the Airline of a ......
Read more >Associate and disassociate table rows using the Web API
The easiest and most common way to do this is by appending the @odata.bind annotation to the name of the single-valued navigation property...
Read more >sap.ui.model.odata.v4.ODataContextBinding - API Reference
ODataModel#submitBatch to submit the changes or sap.ui.model.odata.v4. ... Since 1.98.0, a single-valued navigation property can be treated like a function ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Marvin,
yes, that is the idea.
Best regards Mathias.
Alright, thank you very much for your effort! 😃
Kind regards Marvin