Sobes.tech
Junior — Senior

Display of class inheritance in database tables

livecode

Task condition

The system has a hierarchy of entities marked with the @Entity annotation. It is necessary to determine which tables the database will form when applying the inheritance strategy used by default in JPA. What specific tables and columns will appear? How is the default inheritance mechanism implemented? Then, change the inheritance strategy and describe the differences between the options.

@Entity
class User { int attr1; /* ... */ }

@Entity
class Customer extends User { int attr2; /* ... */ }

@Entity
class Employee extends User { int attr3; /* ... */ }

@Entity
class Admin extends Employee { int attr4; /* ... */ }