View on GitHub

reading-notes

Code 201 Reading Notes

Related Resources and Integration Testing

  1. One-to-one relationship - w @OneToONe a one to one relationship can be created between two @Entities. Naming throughout must be intentional, otherwise JSON issues will arise.
    • to make this work, interfaces must be implemented
    • public interface LibraryRepository extends CrudRepository<Library, Long> {}
    • public interface AddressRepository extends CrudRepository<Address, Long> {} - at which an instance can be created and then used to turn it into json, and without an association, a GET request will return a null object. - once both instances (?) are persistent, they can be related by an association resouce via URL parameters.
  2. One-to-many - created and associated by using “/” routes to associate the related objects and properties with that “one” to “many” relationship and its objects.

  3. Many-to-many - can be associated with other relationships by having the same route somewhere along the path.

  4. This can all be tested.

Integration Testing

It’s IMPORTANT