Before moving ahead, let's design the Java POJOs and the related tables in the database. Let's recall that we are trying to create a Healthcare-based web application comprising of domain objects, such as doctors, patients, hospitals, and so on. The following are some the domain objects for the preceding mentioned application:
- User
- Doctor: For a doctor, one would want to record health centers where he/she makes a visit and, also, his/her qualification
- Rx (representing prescription)
- Medicine
- Health centres (representing clinic, hospital, and so on)
The following are different tables, which can be created for capturing data related with preceding domain objects:
- user
- doctor
- doctor_location
- doctor_qualification
- health_centre
- medicine
- rx
- rx_medicine
Let's take a look at the Java code for one of the domain object and...