java - Jackson mapping a relationship -
i'm using jersey , expecitng post entity. thst post contain uuid 1 of relationships:
jersey resource:
@post public workstationentity save (workstationentity workstationentity) { //workflowprocessentity workflowprocessentity = workflowprocessservice.findbyuuid(); workstationservice.save(workstationentity); return workstationentity; } how can adjust following mapping it'll recognize relationship , save correctly? workflow_process_id null when it's saved , have query entity manually.
the json being posted is... {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; } workstationservice
@transactional public void save(workstationentity workstationentity) { workstationrepository.save(workstationentity); }
can show code workstationservice? using hibernatr or simple jdbc or other orm tool?
i think inside workstationservice.save(workstationentity); need attach workstationentity session (in case of hibernate hibernate session). , save it..
Comments
Post a Comment