database - In a inheritance joined with jpa the tables need pk? And its better have a extra table for role or just have a column role -
i have 3 tables 4 tables, role, person, executive, partner, admin.
person: id, name, phone, address
executive: id_executive, office_number, office_phone, office_email
admin: id_admin
partner: id_partner, phone , email
role: id_role, role_description
i have 2 doubts:
if in inheritance(joined) in jpa need have in tables primary key, example primary key in person table necessary, primary key id_executive on executive table, id_admin primary key in admin table , id_partner in partner table needed? in classes need id in person class, in tables need primary key each table?
if in case 3 tables(admin,partner,executive) better have 4th table role, in 1-to-many relationship person, or if better have column "role" in person table. know option better , why? or icual?
Comments
Post a Comment