java - How to add elements in a many-to-many relationship via Spring's @RepositoryRestResource REST API? -
I find it difficult to use the @RepositoryRestResource interface to create multiple-to-many relationships between the two Fairly simple institutions for For example, I have a relation with such a simple parent-child institution:
@public parents of the public class {@} @ generatedValue Private Long ID; @ManyToMany private list & lt; ChildEntity & gt; children; } @Entity Public Class ChildInty {@Id @GeneratedValue Private Long ID; @ManyToMany (mapped = "kids") private list & lt; ParentEntity & gt; mother-father; } My treasures are using vanilla spring @RegositoryRRRSRSRSHatos API: @RepositoryRestResource (collectionResourceRel = "parent", path = " Parents ") Public Interview Parent Repository Paging & Supporting Repository & lt; ParentEntity, Long & gt; {} @RepositoryRestResource (collectionResourceRel = "kids", path = "kids") Public interface hair regoratory paging and supporting repository & lt; ChildEntity, Long & gt; {} I have been successful in using POST to create personal guard and child-building but I can not understand how to PUT / Patch the built-in interface Using both between
It seems that I should be able to use JSON like PUT to do something like http: // localhost: 8080 / api / parents / 1 / children But so far I'm not getting a structure that works.
I got an answer here:
Instead of JSON, "Content-Type: Using text "/ ure-list", it is possible to "add" a resource in the archive and put it in the URI with Put. You can remove the resource with a delete.
After some excavation, I came to know that Spring Documentation describes this:.
Comments
Post a Comment