Hello,
I have some issues with multi-level hierarchy mapping using the "Table per subclass" strategy.
Here is the list of the db tables I am trying to map using the "Table per Subclass" strategy:
4 Tables:
USER (Abstract Superclass)
EMPLOYEE (USER Subclass)
CUSTOMER (USER Subclass)
MANAGER (EMPLOYEE Subclass)
Following the principles of ERM, I should have this approach since I will need to associate MANAGER, CUSTOMER, and EMPLOYEE instances to different types of relationships table mapping them to other other entities.
I tried the "Table per Subclass" strategy from the Hibernate reference manual, and I got it to work. However, once I added a relationship to EMPLOYEE, I encountered problems. Basically, I was unable to add a <join> statement to the EMPLOYEE mapping file.
Apparently <joined-subclass> does not like <join>, hence, what am I suppose to use in replacement of <join>???
The db schema is as follows:
EMPLOYEE * == 1 EMPLOYEE_DEPARTMENT * == 1 DEPARTMENT
That is, EMPLOYEE_DEPARTMENT is a many-one relationship between the two entities EMPLOYEE and DEPARTMENT.
I tried to resolve this problem with the "Table per subclass, using a discriminator" strategy and it worked. But I had to add a discriminator to the tables. Is there any other way to accomplish this without having to deal with discriminators?
_________________ Thanks,
Arturo
|