我正在使用泽西岛,并且希望将 POST 作为一个实体。然而 thst POST 也将包含UUID
其关系之一:
泽西资源:
@POST
public WorkstationEntity save (WorkstationEntity workstationEntity) {
//WorkflowProcessEntity workflowProcessEntity = workflowProcessService.findByUUID();
workstationService.save(workstationEntity);
return workstationEntity;
}
如何调整以下映射以便识别关系并正确保存?目前workflow_process_id
保存时为NULL,我必须手动查询实体。
正在发布的 JSON 是...{name: Workstation 1; workflow_process_id: 1}
private WorkflowProcessEntity workflowProcess;
@ManyToOne
@JoinColumn(name = "workflow_process_id", referencedColumnName = "id")
public WorkflowProcessEntity getWorkflowProcess() {
return workflowProcess;
}
public void setWorkflowProcess(WorkflowProcessEntity workflowProcess) {
this.workflowProcess = workflowProcess;
}
工作站服务
@Transactional
public void save(WorkstationEntity workstationEntity) {
workstationRepository.save(workstationEntity);
}