I use Spring Data REST to expose my Entity and their relationship. I have one OneToOne relationship between two Entity, and I'm trying to update / change the relationship with PUT and PATCH.
I noticed that Spring Data REST will allow you to update related resources - JPA matched Entity (OneToMany, ManyToOne, etc.), which are also AggregateRoots (has a repository) - through PATCH and are ignored using PUT .
This can be seen in the LinkedAssociationSkippingAssociationHandler class:
if (associationLinks.isLinkableAssociation(association)) {
return;
}
Why is this? What are the reasons for this?
Is it because design wants us to consider associations as resources themselves, as shown in this part of the documentation ? I can change the relationship via PUT with the text Content-Type / uri-list, but it looks unnatural and requires an additional HTTP request.
source
share