I have the following database tables: lookup and employee.
Lookup Table: structure with sample data.
class_name | value | description |
---|---|---|
SEX_CODE | 1 | Male |
SEX_CODE | 2 | Female |
BANK_CODE | 1 | HSBC |
BANK_CODE | 2 | CityBank |
Employee Table: structure with sample data.
id | name | sex_code | bank_code |
---|---|---|---|
1 | Yusuf | 1 | 1 |
2 | Maher | 1 | 2 |
3 | Suzan | 2 | 1 |
I tried to map an abstract class to lookup table and use class_name column as discriminator for the subclasses Sex and Bank and reference the bank and sex as ManyToOne in the employee object.. but I'm getting a class cast exception when the sex_code and bank_code has the same value.
I tried to create views Sex_lookup and Bank_lookup and map them directly to entities. again hibernate complains that he can't find a table with such name.
Help please.
Maybe you will manage to hit the forum for Hibernate questions on the third try.