Skip to content
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

Nested entities are replaced with new instances instead of being updated when merging [DATAREST-938] #1308

Closed
spring-projects-issues opened this issue Nov 11, 2016 · 0 comments
Assignees
Labels
type: bug
Milestone

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Nov 11, 2016

Craig opened DATAREST-938 and commented

When using the repository domain object update end point (via the PATCH method with JSON data), nested objects are replaced with new instances instead of updates being applied to the existing instance.

For example, given these classes:

@JsonAutoDetect(fieldVisibility = Visibility.ANY)
static class Outer {

	String name;
	String prop;
	Inner inner;
}

@JsonAutoDetect(fieldVisibility = Visibility.ANY)
static class Inner {

	String name;
	String prop;
}

Let there be an instance of Outer like this:

Inner inner = new Inner();
inner.name = "inner name";
inner.prop = "something";
Outer outer = new Outer();
outer.prop = "else";
outer.name = "outer name";
outer.inner = inner;

Then make an HTTP PATCH request to update that object with this request body:

{ "inner" : { "name" : "new inner name" } }

the resulting Outer object should have inner.prop="something" but inner.prop is actually null


Affects: 2.6 M1 (Ingalls), 2.5.4 (Hopper SR4)

Issue Links:

Referenced from: pull request #241

Backported to: 2.6 RC1 (Ingalls), 2.5.6 (Hopper SR6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug
Projects
None yet
Development

No branches or pull requests

2 participants