You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Slavomír Bavala (Jira)" <ji...@apache.org> on 2020/01/10 15:19:00 UTC
[jira] [Created] (OLINGO-1420) Unable to perform deep insert using
Olingo V2 when navigation properties relationship is 1:N
Slavomír Bavala created OLINGO-1420:
---------------------------------------
Summary: Unable to perform deep insert using Olingo V2 when navigation properties relationship is 1:N
Key: OLINGO-1420
URL: https://issues.apache.org/jira/browse/OLINGO-1420
Project: Olingo
Issue Type: Bug
Components: odata2-core
Affects Versions: V2 2.0.11
Reporter: Slavomír Bavala
Use case: perform deep insert using Olingo V2
As described in https://issues.apache.org/jira/browse/OLINGO-1401 Olingo will not serialize navigation properties and their contents into the request if _contentOnly_ flag is set to *true*.
We set it to *false* but that adds metadata to the request payload as a result. In case of an update, where key properties are not present in the payload but in the URL, the metadata generation will fail (we wrote a hack to overcome this).
The biggest problem we found is the serialization of +_childNavigationProperty_+ properties described by 1:N relationship, see the following example:
{code:java}
{
"rootLevelProperty": "",
"rootLevelNavigationProperty": [
{
"child": "1",
"childNavigationProperty": [
{
"grandChild": "X"
}
]
},
{
"child": "2",
"childNavigationProperty": [
{
"grandChild": "Y"
}
]
}
}
}{code}
To serialize the navigation properties we need to specify the _customExpanedLinks_ for every nested level. We also need to specify _callbacks_ for every navigation property (this means also defining nested callbacks for nested navigation properties).
When navigation property is described by 1:N relationship, we need to register a _OnWriteFeedContent_ callback. This callback however doesn't allow us to specify nested callbacks for every item in the list, we can only register a single callback for the +*entire feed*+. This means we are not able to serialize _grandChild_ property correctly and we have to choose either "X" or "Y" as a value for both items.
Our code looks like this:
{code:java}
writeEntry(APPLICATION_JSON, rootEntitySet, dataMap,
serviceRoot(new URI(entitySetName))
.omitJsonWrapper(true)
.contentOnly(update) //true for updates
.expandSelectTree(expandSelectTreeNodeBuilder.build()) //tree of customExpanedLinks so navigation properties are serialized
.callbacks(createCallbacks(navigationPropertyMap, rootEntityType)) // tree of callbacks to provide data for all customExpanedLinks defined above
.build()
{code}
How can we perform such deep insert using Olingo?
Are we using the library as intended?
Does Olingo V2 even supports deep inserts?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)