I'm working on staff management application for a clinic, basic scenario, but learning about JPA inheritance lead me to over think some parts, and I need help to clear my thoughts and design.
I have some obvious classes: employee, clerk, medical staff, nurse, doctor..etc... the conform to a class hierarchy where everyone is an employee, a nurse and a doctor are medical staff:
employee <__ clerk |__ medical staff<__ nurse |_ doctor
and I thought about representing this hierarchy with java classes using JPA inheritance table per class strategy.
- Each class reuses data and methods from parent classes.
- The database ensures data integrity especially for relationships with other entities i.e a patient relationship to a doctor not to a clerk.
- The design is logical and beautiful.
- This design is future proof, as it's required to add many tables in the future as more data is available.
- I think I'm overdoing it.
- Too many pages to input && modify data.
- Tables (in the view) that holds data form more than one Entity looks bad, and handling Class Cast and Type checks are cumbersome.
So I need some advice on such design, what is the way to go? and what am I missing there?