title: How to create Entity Class for multiple table joins
body: <p>I am developing a spring boot application, i need a proper design help for one of my entity relation.</p>
  
  <p>These are my tables</p>
  
  <pre><code>DROP TABLE IF EXISTS user;
  CREATE TABLE user
  (
   User_ID   INT AUTO_INCREMENT PRIMARY KEY,
   Email     VARCHAR(1024),
   Phone     BIGINT,
   Password  VARCHAR(128),
   User_Type ENUM ('TEACHER', 'PARENT'),
   Status    ENUM ('ACTIVE', 'DEACTIVE', 'SUSPENDED')
   );
  
  DROP TABLE IF EXISTS teacher;
  CREATE TABLE teacher
  (
     Teacher_ID      INT AUTO_INCREMENT PRIMARY KEY,
     Name            VARCHAR(1024),
     Email           VARCHAR(1024),
     Phone           BIGINT,
     Gender          ENUM (0, 1),
     Date_Of_Joining INT,
     Designation     VARCHAR(1024),
     Is_Active       INT
  );
  
  DROP TABLE IF EXISTS parent;
  CREATE TABLE parent
  (
    Parent_ID  INT AUTO_INCREMENT PRIMARY KEY,
    Name       VARCHAR(1024),
    Email      VARCHAR(1024),
    Phone      BIGINT,
    Occupation VARCHAR(1024),
    Address    VARCHAR(4048)
  );
  
  
  DROP TABLE IF EXISTS student;
  CREATE TABLE student
  (
    Student_ID    INT AUTO_INCREMENT PRIMARY KEY,
    Student_Name  VARCHAR(1024),
    Class         VARCHAR(16),
    Section       VARCHAR(16),
    Academic_Year VARCHAR(64),
    DOB           DATE,
    Gender        ENUM (0, 1),
    Parent_ID     INT
  );
  </code></pre>
  
  <p>Can anyone please help me creating entity classes for the same. Based on the type of user in user table i need to join with either teacher or parent table. For example if User_Type is TEACHER then i will join with teacher table else i will join user with parent table. Join condition would be email.</p>
  
  <p>Student table has one to one relationship with parent table.</p>