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

PUT empties nested collection [DATAREST-953] #1323

Closed
spring-projects-issues opened this issue Dec 6, 2016 · 4 comments
Closed

PUT empties nested collection [DATAREST-953] #1323

spring-projects-issues opened this issue Dec 6, 2016 · 4 comments
Assignees
Labels
type: bug
Milestone

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Dec 6, 2016

Mathias D opened DATAREST-953 and commented

In the following scenario Parent and Child are entities and Item is either a Embeddable or an Entity. Only Parent has a repository that is also exported.

!http://www.yuml.me/diagram/scruffy/class/%2F%2F Cool Class Diagram, [Parent]->[Child], [Child]<>-*>[Item]!

Posting such a structure works fine but the PUT empties the Item collection in Child.

Please see this project to reproduce the issue - https://github.com/mduesterhoeft/sdr-put-nested-list.

Such a scenario has been working in Hopper-SR4 and started to be broken since Hopper-SR5.


Here are the requests I am issuing:

  • Create parent
POST /parents -> 201
{
    "child": {
        "items": [
          {"some": "test"}]
    }
}
  • update parent
PUT /parents/id -> 204
{
    "child": {
        "items": [
          {"some": "test123"} ]
    }
}

After the PUT the items collection is empty


Affects: 2.5.5 (Hopper SR5)

Reference URL: https://github.com/mduesterhoeft/sdr-put-nested-list

Issue Links:

  • DATAREST-938 Nested entities are replaced with new instances instead of being updated when merging

  • DATAREST-944 Unable to add to a nested collection

  • DATAREST-954 Patching on nested @ElementCollection Map<> using application/merge-patch+json throws org.springframework.orm.jpa.JpaSystemException

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 6, 2016

Mathias D commented

Seems to be related to DATAREST-944

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Oliver Drotbohm commented

I just added a test case to verify the fix for DATAREST-938 also fixes the scenario you describe. Care to give the latest snapshots a try?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Mathias D commented

Thanks for the hint. I will give it a try

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Mathias D commented

Just tested with 2.6.0.BUILD-SNAPSHOT and the scenario described works. Existing collection items are updated now.

I am afraid adding items to the collection is still not working. I think I create another issue for this.

Thanks a lot so far

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