Exercise Solutions: The Early Bird gets the ORM!

Here is an example of how the README may turn out:

  1. Our Person class might hold the following fields:

    1. id (int) - the unique user ID

    2. firstName (String) - the user’s first name

    3. lastName (String) - the user’s last name

    4. email (String) - the user’s email, which will also function as their username

    5. password (String) - the user’s password

    The class would need getters for all of these fields. It could have setters for all fields except id (since it shouldn’t change).

  2. The Person class might also have the following references:

    1. PersonProfile - a class to gather up all of the profile information about the user

    2. List<Events> eventsAttending - to store events the user wants to attend

    3. List<Events> eventsOwned - a different list, to store the events the user has created

Person would have a many-to-many relationship with Event via List<Events> eventsAttending. It would have a one-to-many relationship with Event via List<Events> eventsOwned.

Back to the exercises