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

One to Many not save link array [DATAREST-1310] #1670

Open
spring-projects-issues opened this issue Nov 29, 2018 · 5 comments
Open

One to Many not save link array [DATAREST-1310] #1670

spring-projects-issues opened this issue Nov 29, 2018 · 5 comments
Assignees
Labels

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Nov 29, 2018

sante85 opened DATAREST-1310 and commented

Hello everyone, got one (hah!) little problem of my own with Spring Data Rest... I've got a List<Child> children in my Father object, with @OneToMany(mappedBy="father"). Together with the Repositories, this lead to the fact that I can PUT a http://localhost:8080/children/1 text/uri-list to http://localhost:8080/fathers/1/children - and get a 204. But nothing changes, since the collection will be set correctly (by RepositoryPropertyReferenceController.createPropertyReference), but that doesn't change the Child.father reference. So, is there a way to automatically update it when a child is added to the list in Spring Data Rest? Or is there a way to make the thing fail at least, because atm it's failing but claiming to succeed, which is imho the worst thing possible...
Of course, the basic problem is JPA based, since already there adding something to the list and then saving the father does not update the Child.father reference. But with Spring Data Rest, it looks like it works - but the result is wrong


Affects: 3.1.3 (Lovelace SR3)

Attachments:

Issue Links:

  • DATAREST-1311 One to Many put not change a collection
    ("is duplicated by")

3 votes, 1 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 29, 2018

sante85 commented

i edit this in spring data jpa test

and resul test is in error

 

@Test // DATAREST-523
public void augmentsOneToManyCollectionAssociationUsingPost() throws Exception {

List<Link> links = preparePersonOrderResources(new Person("Frodo", "Baggins"),
new Order(), new Order());

Link frodosSiblingsLink = links.get(0).expand();
Link bilboLink = links.get(1);

for (int i = 1; i <= 2; i++) {

mvc.perform(post(frodosSiblingsLink.getHref()).//
content(bilboLink.getHref()).//
contentType(TEXT_URI_LIST)).//
andExpect(status().isNoContent());

mvc.perform(get(frodosSiblingsLink.getHref())).//
andExpect(jsonPath("$._embedded.people", hasSize(i)));
}
}

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 5, 2018

sante85 commented

How much time is estimated for the bug resolution?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 5, 2018

sante85 commented

There is a workaround?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 14, 2018

sante85 commented

Hi Oliver,

how many time is estimated?

 

Best Regards

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jan 4, 2019

sante85 commented

Hi Oliver,

in which version bug will be resolved?

 Many thanks

Best Regards

 

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

No branches or pull requests

2 participants