托管关联和cds-odata-v2-adapter-proxy的问题

2020-09-02 15:59发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)嗨, 我正在使用CDS ODa...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我正在使用CDS OData v4服务的新OData v2适配器代理(@ sap/cds-odata-v2-adapter-proxy),但是托管关联存在问题:

db \ data-model.cds:

命名空间待办事项;

 实体任务{
     密钥ID:整数;
     title:字符串;
     完成:布尔值;
     plannedTasks:与plannedTasks.task = $ self上的许多PlannedTasks的关联;
 }

 实体人物{
     密钥ID:整数;
     名称:字符串;
     plannedTasks:与plannedTasks.person = $ self上的许多PlannedTasks关联。
 }

 实体PlannedTasks {
     关键任务:任务关联;
     关键人物:人民协会;
     键startDate:DateTime;
     key endDate:DateTime;
     暂定:布尔值;
 }

 

获取/v2/todo/People?$ expand = plannedTasks

 {
 " d":{
 "结果":[{
 " ID":1
 " name":" Joe",
 " plannedTasks":{
 "结果":[{
 " startDate":"/img/Date(1566518400000)/",
 " endDate":"/img/Date(1566518400000)/",
 "暂定":是的,
 " task_ID":1
 " person_ID":1
 " __metadata":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(task = undefined,person = undefined,startDate = datetimeoffset'2019-08-23T00:00:00Z',endDate = datetimeoffset'2019-08-  23T00:00:00Z',task_ID = 1,person_ID = 1)",
 " type":" TodoService.PlannedTasks",
 " etag":" W/\" QMV7j0dk99JE5TC7oLbhyym0Kkqvdle9NMPCOMMVHWE = \""
 },
 "任务":{
 " __deferred":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(任务=未定义,人=未定义,startDate = datetimeoffset'%2FDate(1566518400000)%2F',endDate = datetimeoffset'%2FDate(1566518400000)%  2F',task_ID = 1,person_ID = 1)/task"
 }
 },
 "人":{
 " __deferred":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(task = [object%20Object],person = undefined,startDate = datetimeoffset'%2FDate(1566518400000)%2F',endDate = datetimeoffset'%2FDate  (1566518400000)%2F',task_ID = 1,person_ID = 1)/人"
 }
 }
 }]
 },
 " __metadata":{
 " uri":" http://localhost:4004/v2/todo/People(1)",
 " type":" TodoService.People",
 " etag":" W/\" QMV7j0dk99JE5TC7oLbhyym0Kkqvdle9NMPCOMMVHWE = \""
 }
 },
 {
 " ID":2
 " name":" Jane",
 " plannedTasks":{
 "结果":[]
 },
 " __metadata":{
 " uri":" http://localhost:4004/v2/todo/People(2)",
 " type":" TodoService.People",
 " etag":" W/\" QMV7j0dk99JE5TC7oLbhyym0Kkqvdle9NMPCOMMVHWE = \""
 }
 },
 {
 " ID":3,
 " name":" Bob",
 " plannedTasks":{
 "结果":[{
 " startDate":"/img/Date(1566604800000)/",
 " endDate":"/img/Date(1566604800000)/",
 "暂定":假,
 " task_ID":2
 " person_ID":3,
 " __metadata":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(task = undefined,person = undefined,startDate = datetimeoffset'2019-08-24T00:00:00Z',endDate = datetimeoffset'2019-08-  24T00:00:00Z',task_ID = 2,person_ID = 3)",
 " type":" TodoService.PlannedTasks",
 " etag":" W/\" QMV7j0dk99JE5TC7oLbhyym0Kkqvdle9NMPCOMMVHWE = \""
 },
 "任务":{
 " __deferred":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(任务=未定义,人=未定义,startDate = datetimeoffset'%2FDate(1566604800000)%2F',endDate = datetimeoffset'%2FDate(1566604800000)%  2F',task_ID = 2,person_ID = 3)/任务"
 }
 },
 "人":{
 " __deferred":{
 " uri":" http://localhost:4004/v2/todo/PlannedTasks(task = [object%20Object],person = undefined,startDate = datetimeoffset'%2FDate(1566604800000)%2F',endDate = datetimeoffset'%2FDate  (1566604800000)%2F',task_ID = 2,person_ID = 3)/person"
 }
 }
 }]
 },
 " __metadata":{
 " uri":" http://localhost:4004/v2/todo/People(3)",
 " type":" TodoService.People",
 " etag":" W/\" QMV7j0dk99JE5TC7oLbhyym0Kkqvdle9NMPCOMMVHWE = \""
 }
 }
 ]
 }
 }
 

实体密钥错误,因此我无法更新PlannedTasks实体:

 http://localhost:4004/v2/todo/PlannedTasks(任务=未定义,人=未定义,startDate = datetimeoffset'2019-08-23T00:00:00Z',endDate = datetimeoffset'2019-08-23T00:  00:00Z',task_ID = 1,person_ID = 1)

使用OData v2和CDS Java的类似服务没有任何问题。

这是源代码: https://github.com/pdominique/cap-todo

干杯

皮埃尔

6条回答
compass1988
2020-09-02 16:25

您好,Oliver,

我刚刚进行了快速测试,问题似乎已经解决。 谢谢!

Pierre

一周热门 更多>