Labs

  1. Create a Store entity with the following fields.

  2. id (don't forget to add @GeneratedValue)

  3. address (of type Address)

Here is the store table for reference:

+------------+----------------------+------+-----+---------+----------------+
| Field      | Type                 | Null | Key | Default | Extra          |
+------------+----------------------+------+-----+---------+----------------+
| id         | smallint(5) unsigned | NO   | PRI | NULL    | auto_increment |
| manager_id | int(10) unsigned     | YES  | UNI | NULL    |                |
| address_id | int(10) unsigned     | NO   | UNI | NULL    |                |
+------------+----------------------+------+-----+---------+----------------+
  1. Add a uni-directional, one-to-one relationship between Store and Address. Think about which entity would be the owning entity.

  2. NOTE: For now don't do anything with the manager_id

  3. Create a JUnit test for Store in a class named StoreTest within the test src folder.

  4. Query for store with id=1 and ensure that the address's city is "Seattle"


Prev -- Up