I have classes that follow a composite pattern relationship for which I need to create the relational data model for Oracle database. The (java) classes are as below -
class AbstractEmployee {
int employeeId;
}
class Employee extends AbstractEmployee {
Date joiningDate;
}
class Supervisor extends AbstractEmployee {
List<AbstractEmployee> directs;
int officeLocationId;
}
Clearly, there are attributes which are shared across all classes and there are other attributes which are specific to each class. What would be the best way to create sql tables for the above scenario?
I can see that there are different ways to handle hierarchy namely - TPC, TPH and TPT as provided on this post - inheritance in databases. However, composite patterns pose additional complexity in being intrinsically recursive structures, and as a result, the select/insert query performance can be drastically impacted by the schema.
If possible, please discuss the pros/cons of your solution in terms of scalability and performance.
Aucun commentaire:
Enregistrer un commentaire