If you are using Table per class it means Employee , Regular Employee and Contract Employee all must be created at same time.
It means EACH EMPLOYEE from employee table is either Regular or on contract.
I think you made Employee first and then added those two tables later. This is wrong approach!
There is still lot to learn!
Joined: Jun 28, 2007
Mahendr Shinde wrote:I think you made Employee first and then added those two tables later. This is wrong approach!
this might be wrong approach for Hibernate inheritance mapping.
But, the scenario is:
I have an EMPLOYEE table with multiple columns. I execute many queries on EMPLOYEE table.
Now, there is an enhancement that is specific for few employees. These few Employees are categorised as REGULAR_EMP and CONTRACT_EMP. Please note that there can be Employees who are neither Regular nor Contract Emp.
Now, I don't want to do changes in existing EMPLOYEE table just for few Employees.
It seems I should go with one-to-one relationship instead of inheritance. am I right?