spring-projects / spring-projects/spring-data-rest
Unable to delete relationships in NEO4j using PUT/PATCH?DELETE [DATAREST-1301]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Fuzail Sarang opened DATAREST-1301 and commented
Using Spring Boot 2.1.0 with the Spring Boot Starter for Neo4j and Spring Data Rest with Spring Transactions.
Attached files to reproduce.
Scenario is the following
- Create Parent
curl -i -X POST -H "Content-Type:application/json" -d '{}' http://localhost:8080/parent
- Create Child
curl -i -X POST -H "Content-Type:application/json" -d '{}' http://localhost:8080/child
- Create association
curl -i -X PUT -H "Content-Type:application/json" -d "http://localhost:8080/parent/<id>" -H "Content-Type:text/uri-list" http://localhost:8080/child/<id>/parent
- Attempt to delete association
curl -i -X DELETE http://localhost:8080/child/1743/parent
Above will not delete the association as the Spring transaction is not started, instead it will use multiple Neo4J Transactions that will result in the relationship not being deleted. I have also attached a test which highlights the issues without the need for the rest calls. This has the same issue when updating using PUT/PATCH to remove associations.
Affects: 3.1.2 (Lovelace SR2)
Reference URL: https://stackoverflow.com/questions/25717127/handle-spring-data-rest-application-events-within-the-transaction
Attachments:
- Application.java (567 bytes)
- Child.java (553 bytes)
- ChildRepository.java (557 bytes)
- Parent.java (655 bytes)
- ParentChildTests.java (1.39 kB)
- ParentRepository.java (562 bytes)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.