@OneToOne
within each class (before an instance of the related class), two classes may be related.
@RestResource
) may be included to further define the relationship.Respective repository interfaces must be made for each.
CRUD requests may be made with respect to the related resource.
Using the two respective annotations @OneToMany
and @ManyToOne
before an instance of the related class, multiple resources may be related to a single resource.
CRUD requests may be made with respect to the related resource to both associate an instance (PUT) and to GET the associated resources.
Tested by POST-ing more than two objects, the PUT-ing the same relationship to the first with each other (respectively)
@ManyToMany
, individual instances of one resource may be associated with multiple others (including webbed relationships)Integration testing is used to verify that resources have the expected relationships and interactions. (Some documentation here)
The annotations @ExtendWith()
, @ContextConfiguration()
, and @WebAppConfiguration
set up the testing context for the given classes to simulate relationships and associated behaviors