Skip to content

Json Patch - attempt to update attribute of an nested object is not happening. #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
prats2017 opened this issue Apr 8, 2020 · 0 comments

Comments

@prats2017
Copy link

prats2017 commented Apr 8, 2020

I am trying to assign new dept to Employee using deptNameusing JsonPatch but the update to DB is not happening. I noticed that my patched object has Dept object has new/updated name but no is still pointing to old deptNo. Looks like Patch is attempting to update dept.deptName instead of updating reference to entire dept entity (which I think should be the case). what am i missing here?

[{"op":"replace", "path":"/dept/name","value":"HR"} ]

@entity
public class EMP{
@manytoone(fetch = FetchType.LAZY)
@joincolumn(name = "deptNo", referencedColumnName = "deptNo")
private Dept dept;
}

@entity
public class Dept {
private String deptName;
private Integer deptNo;
}

@prats2017 prats2017 changed the title Json Patch - Update nested an attribute in nested object Json Patch - attempt to update attribute of an nested object is not happening. Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant