From: javed m. <ja...@gm...> - 2007-06-06 06:09:56
|
Hibernate version: 3.1.3 Name and version of the database you are using: Oracle 10 Hi I have a question regarding how many-to-one relationship should be defined where the parent class is same type as the child class. -------------------- Person table --------------------- - name - surname - national_id - (PKey) - passport_id - (PKey) - address - parent_national_id - (Parent -PK) - parent_passport_id - (Parent -PK) ------------------------ Take the case of the table above where a person is defined within a person table and has a composite key national_id and passport_id. Now I want to get the Parent for that person which has composite key parent_national_id and parent_passport_id defined within the Person table. How would the hibernate mapping configuration would look like. When I do a getParent on a Person object i would want to get its parent of type Person. |