Add fields to the entities

Before mapping the entities to the database, you must add the necessary fields to each entity.

  1. Add the following fields to the Employee entity:

    private Long id;
    private String firstNname;
    private String lastName;
    private String address;
    private List<PhoneNumber> phoneNumbers;
    private Long version;
    
  2. Import java.util.List.

  3. Generate Getters and Setters for each field.

  4. Add the following fields to the Address entity:

    private Long id;
    private String street;
    private String city;
    private String stateOrProvince;
    private String country;
    private String postalCode;
    
  5. Add the following fields to the PhoneNumber entity:

    private String type;
    private String areaCode;
    private String number;
    private Employee owner;
    

Next, you will Associate the entity with a database table.