Hi!
I have the following EMPLOYEE table which contains one director (TYPE=D) and two managers (TYPE=M). The managers are reporting to the director John (SUPERIOR=0):
Code:
ID NAME TYPE SUPERIOR
0 John D NULL
1 Andrew M 0
2 Mark M 0
I have created the following mapping:
Code:
<class name="Employee" table="EMPLOYEE">
<id column="ID" type="integer"/>
<discriminator column="TYPE" type="string"/>
<subclass name="Director" discriminator-value="D"/>
<subclass name="Manager" discriminator-value="M"/>
</class>
How can I create the mapping so that a Director.getManagers() will return a list of Manager objects?
Whereas the Manager.getDirector() will return the corresponding Directory object?
Please help, thank you!