Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Olingo JPA Odata Producer-当实体之间存在关联时,如何插入记录_Jpa_Odata_Olingo - Fatal编程技术网

Olingo JPA Odata Producer-当实体之间存在关联时,如何插入记录

Olingo JPA Odata Producer-当实体之间存在关联时,如何插入记录,jpa,odata,olingo,Jpa,Odata,Olingo,我已经使用olingo+JPA创建了一个oData生产者,MYSQL Db具有northwind实现。 我有一个表northwind.inventory\u transactions,它与northwind.inventory\u transaction\u类型具有fk关系,它在JPA中转换为对象关系。当我使用odata时,我得到以下响应: 获取请求 http/localhost:8080/sample/galaxyService.svc/InventoryTransactions?$forma

我已经使用olingo+JPA创建了一个oData生产者,MYSQL Db具有northwind实现。 我有一个表northwind.inventory\u transactions,它与northwind.inventory\u transaction\u类型具有fk关系,它在JPA中转换为对象关系。当我使用odata时,我得到以下响应:

获取请求 http/localhost:8080/sample/galaxyService.svc/InventoryTransactions?$format=json&$top=1

{d:{结果:[{ __元数据:{id:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)”, uri: “http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)”, 类型:“sample.InventoryTransaction”},注释:null,客户:4, 额外:null,Id:35,InventoryTransactionType:1,订单:null, PurchaseOrder:null,数量:75,TransactionCreatedDate: “/日期(1143023548000)/”,交易修改日期: “/日期(1143023548000)/”,重量:“0”,客户详细信息:{ __延迟:{
在此处输入代码
uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/CustomerDetails” }},InventoryTransactionTypeDetails:{ __延迟:{uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/InventoryTransactionTypeDetails” }},订单详细信息:{ __延迟:{uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/OrderDetails” }},产品详细信息:{ __延迟:{uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/ProductDetails” }},PurchaseOrderDetails:{ __延迟:{uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/PurchaseOrderDetails” }},PurchaseOrderDetails详细信息:{ __延迟:{uri:“http/localhost:8080/sample/galaxyService.svc/InventoryTransactions(35)/PurchaseOrderDetailDetails” }}}]}}

使用POSTMAN插件在同一个服务器上尝试POST操作时,我得到的异常为“” 以下是请求 POST http/localhost:8080/sample/galaxyService.svc/InventoryTransactions

{ “评论”:“, “客户”:4, “额外”:空, “订单”:空, “PurchaseOrder”:空, “InventoryTransactionType”:1, “数量”:75, “TransactionCreatedDate”:“/日期(1143023548000)/”, “TransactionModifiedDate”:“/日期(1143023548000)/”, “权重”:“0”

} 错误:

异常[EclipseLink-4002](Eclipse持久性服务-2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException 内部的 例外情况: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: 列“事务类型”不能为空 错误代码:1048 调用:插入库存交易记录(ID、注释、额外、, 数量、交易记录创建日期、交易记录修改日期、重量、, 客户代码、交易类型、客户订单id、产品id、, 采购订单id)值(?、、、、、、、、、、、、、、、、、、、、?) 绑定=>[12个参数绑定] 查询: InsertObjectQuery(模型。InventoryTransaction@63adef6d)

有没有人能指导我们如何处理这样的关系

谢谢, 阿努巴夫