Labs

For each of the following labs, update the appropriate JUnit test cases based on the new relationships.

Note: To test all of the mappings you are about to create, add to your existing JUnit test classes. When you change a relationship, update a JUnit test.

  1. Add the appropriate annotations to describe a uni-directional, many-to-one relationship between Staff and Address.

  2. Staff should store a field of type Address, but Address does not store a collection of Staff.

  3. Don’t forget to add get and set methods for your field.

  4. Create a uni-directional, many-to-one relationship between Rental and Staff.

  5. Use your solution to #1 as a guide.

  6. Add the appropriate annotations to describe a bi-directional, many-to-one relationship between Rental and Customer.

  7. Don’t forget to add get/set methods.

  8. Create add and remove methods in the side of the relationship that contains the field of type List.

  9. Like #3, create a bi-directional, many-to-one relationship between Customer and Store.

  10. Don’t forget to add get/set/add/remove methods.

  11. Similar to #3 and #4, add code to describe a bi-directional, many-to-one relationship between Staff and Store.

  12. Don’t forget to add get/set/add/remove methods.

  13. Finally, build a uni-directional, one-to-one relationship between Store and Staff so that the Store knows its manager.


Prev -- Up