Adding Properties to User
Explore how to expand the User entity by adding essential properties such as gender, birthday, email, and phone number. Understand the use of enums, value objects, JPA converters, and validation annotations to integrate these fields properly into the database. Learn to update tests and database migrations to support new user data.
We'll cover the following...
We'll cover the following...
Adding properties to User
So far, our User only has a surrogate primary key (the id). Let’s add some more fields like gender, birthday, email and phone number to make things more interesting:
UserNameis a value object that contains thefirstNameandlastNameof a user.Genderis an enum for the possible genders