hibernate-devel

[Prev] Thread [Next]  |  [Prev] Date [Next]

[Hibernate] Many-to-one relationship where parent class is same as child javed mandary Wed Jun 06 00:05:09 2007

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.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel