Exercise Solutions: The Early Bird gets the ORM!¶
Here is an example of how the README may turn out:
Our
Person
class might hold the following fields:
id
(int
) - the unique user ID
firstName
(String
) - the user’s first name
lastName
(String
) - the user’s last name
String
) - the user’s email, which will also function as their username
password
(String
) - the user’s passwordThe class would need getters for all of these fields. It could have setters for all fields except id (since it shouldn’t change).
The
Person
class might also have the following references:
PersonProfile
- a class to gather up all of the profile information about the user
List<Events> eventsAttending
- to store events the user wants to attend
List<Events> eventsOwned
- a different list, to store the events the user has created
Person
would have a many-to-many relationship withEvent
viaList<Events> eventsAttending
. It would have a one-to-many relationship withEvent
viaList<Events> eventsOwned
.