JSON中的Olingo 2 OData JPA深度插入
举个例子,我能够执行深度插入(Car和 驱动程序),但不是JSON。下面是我的JSON 1或2,只有汽车是 已插入,且驱动程序为空。有人能解释我的JSON输入吗?如果我使用Olingo注释(@EdmEntityType等),那么JSON输入没有问题JSON中的Olingo 2 OData JPA深度插入,json,jpa,odata,olingo,Json,Jpa,Odata,Olingo,举个例子,我能够执行深度插入(Car和 驱动程序),但不是JSON。下面是我的JSON 1或2,只有汽车是 已插入,且驱动程序为空。有人能解释我的JSON输入吗?如果我使用Olingo注释(@EdmEntityType等),那么JSON输入没有问题 2014-12-05T14:35:11.141 10 超级的 快车 总氮 553 554 M1 2014 20000 2014-03-20T14:35:17.075 //JSON 1 { “Id”:677, “IdL”:“678”, “型号”:“M
2014-12-05T14:35:11.141
10
超级的
快车
总氮
553
554
M1
2014
20000
2014-03-20T14:35:17.075
//JSON 1
{
“Id”:677,
“IdL”:“678”,
“型号”:“M1”,
“车型年”:2014年,
“价格”:“20000.0”,
“更新”:“\/日期(1395326117075)\/”,
“驱动程序详细信息”:{
“生日”:“\/日期(1417790111141)\/”,
“Id”:“3”,
“姓氏”:“超级”,
“姓名”:“快艇”,
“昵称”:“YZ”,
“卡片细节”:{
“推迟”:{
“uri”:
http://localhost:8080/example/MyFormula.svc/Drivers(3) /cardetals“
}
}
}
}
//JSON 2
{
“d”:{
“_元数据”:{
“类型”:“MyFormula.Car”
},
“Id”:601,
“IdL”:“602”,
“型号”:“M1”,
“车型年”:2014年,
“价格”:“20000.0”,
“更新”:“/日期(1395244800000)/”,
“驱动程序详细信息”:{
“_元数据”:{
“id”:”http://localhost:8080/example/MyFormula.svc/Drivers(11L)“,
“uri”:http://localhost:8080/example/MyFormula.svc/Drivers(11L)“,
“类型”:“MyFormula.Driver”
},
“生日”:“/日期(1417795200000)/”,
“Id”:“11”,
“姓氏”:“超级”,
“姓名”:“快艇”,
“昵称”:“博尔特”,
“卡片细节”:{
“推迟”:{
“uri”:
http://localhost:8080/example/MyFormula.svc/Drivers(11L)/卡片细节“
}
}
}
}
}
很抱歉交叉发布,因为Olingo论坛没有回应。似乎在他们的Jira上发布了相同的问题,但现在应该已经解决了:
而JPA实施具体涉及到哪里?如果是这样的话,那么是哪种实现呢?这是JPA,所以在这里的某个时刻,您可以使用EclipseLink将数据持久化到HSQLDB中,这与JSON有什么关系????!
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="
http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="
http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="
http://localhost:8080/example/MyFormula.svc/">
<category term="MyFormula.Car" scheme="
http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link href="Cars(Id=553,IdL=554L)" rel="edit" title="Car" />
<link href="Cars(Id=553,IdL=554L)/DriverDetails" rel="
http://schemas.microsoft.com/ado/2007/08/dataservices/related/DriverDetails"
title="DriverDetails" type="application/atom+xml;type=entry">
<m:inline>
<entry xml:base="http://localhost:8080/example/MyFormula.svc/">
<category term="MyFormula.Driver" scheme="
http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link href="Drivers(10L)" rel="edit" title="Driver" />
<link href="Drivers(10L)/CarDetails" rel="
http://schemas.microsoft.com/ado/2007/08/dataservices/related/CarDetails"
title="CarDetails" type="application/atom+xml;type=entry" />
<content type="application/xml">
<m:properties>
<d:Birthday>2014-12-05T14:35:11.141</d:Birthday>
<d:Id>10</d:Id>
<d:Lastname>Super</d:Lastname>
<d:Name>Speeder</d:Name>
<d:Nickname>TN</d:Nickname>
</m:properties>
</content>
</entry>
</m:inline>
</link>
<content type="application/xml">
<m:properties>
<d:Id>553</d:Id>
<d:IdL>554</d:IdL>
<d:Model>M1</d:Model>
<d:ModelYear>2014</d:ModelYear>
<d:Price>20000.0</d:Price>
<d:Updated>2014-03-20T14:35:17.075</d:Updated>
</m:properties>
</content>
</entry>
// JSON 1
{
"Id":677,
"IdL":"678",
"Model":"M1",
"ModelYear":2014,
"Price":"20000.0",
"Updated":"\/Date(1395326117075)\/",
"DriverDetails":{
"Birthday":"\/Date(1417790111141)\/",
"Id":"3",
"Lastname":"Super",
"Name":"Speeder",
"Nickname":"YZ",
"CarDetails": {
"__deferred": {
"uri": "
http://localhost:8080/example/MyFormula.svc/Drivers(3)/CarDetails"
}
}
}
}
// JSON 2
{
"d": {
"__metadata": {
"type": "MyFormula.Car"
},
"Id": 601,
"IdL": "602",
"Model": "M1",
"ModelYear": 2014,
"Price": "20000.0",
"Updated": "/Date(1395244800000)/",
"DriverDetails": {
"__metadata": {
"id": "http://localhost:8080/example/MyFormula.svc/Drivers(11L)",
"uri": "http://localhost:8080/example/MyFormula.svc/Drivers(11L)",
"type": "MyFormula.Driver"
},
"Birthday": "/Date(1417795200000)/",
"Id": "11",
"Lastname": "Super",
"Name": "Speeder",
"Nickname": "Bolt",
"CarDetails": {
"__deferred": {
"uri": "
http://localhost:8080/example/MyFormula.svc/Drivers(11L)/CarDetails"
}
}
}
}
}