问题:
如何从 OData V2 模型上的 SAPUI5 客户端应用程序执行“深度插入”?
情况:
我想将“操作”与一些“组件”一起深度插入到我的 SAPUI5 客户端应用程序中的 OData V2 模型中。
// the request data
"OperationSet" : {
"Orderid" : "13700090",
"OperationComponentSet" : [
{
"Orderid" : "13700090",
"Activity" : "0010",
"SubActivity" : "",
"ComponentItem" : "000010"
}
]
}
this.getView().getModel().create("/OperationSet", requestData);
我无法在 OData V2 模型上使用函数 create(sPath, oData, mParameters?),文档显示:“请注意,不支持深度创建,并且可能无法工作。”参见https://sapui5.netweaver.ondemand.com/sdk/docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html#create
是否有其他可能性在 OData V2 模型上执行深度插入?
链接:
最佳答案
答案是,“深度插入”目前不支持与离线 Kapsel 插件的 0..n 关联。
参见http://help.sap.com/saphelp_smp308sdk/helpdata/en/d3/0ded03756247f1a136c84be7901879/content.htm
Limitations of Deep Inserts A deep insert is an OData POST request to create an entity that also contains the inlined definitions of related entities.
When a deep insert is processed, the top-level entity and all of its related entities are created and linked together as a single operation. In SDK SP07, the Offline Store supports deep inserts through the OData API on Android, iOS and WinPhone 8 platforms with one important restriction:
- The navigation property used for the deep insert must refer to at most one entity. Any inlined related entities must be added using a navigation property whose ToRole refers to an association end with cardinality 0..1 or 1. They cannot be added using a navigation property whose ToRole refers to an association end with cardinality *. Navigation properties that refer to a set of entities cannot be used for deep inserts.
因此,只有当前针对网关在线执行请求时,“深度插入”才会起作用。
关于javascript - OData V2 模型上的 Kapsel 离线应用程序的 SAPUI5 深度插入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31585960/