Hibernate version: 2.1.7
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
First, thanks for your time, I am sure just the sight of another "parent-child" in the subject has raised a few people's blood pressure...
Does anyone have recommendations on how to map a single class to a single table which which contains a parent-child relationship? For example, an employee table with a primary key "id" and a column "supervisor_id" constrained to the "id" column (since the supervisor is also an employee.) The "upervisor_id"column would be nullable. Employees working for themselves would would have "supervisor_id" values set to their own "id". The employee object mapped to this table would, in turn, contain a supervisor attribute containing the id value of the supervising employee. All of my attempts at using one-to-one mapping within a class definition result in ClassNotFound exceptions, I assume because the class hasn't been created at the time the mapping is encountered.
All of the references to the parent-child mapping I have seen involved multiple talbes and/or multiple classes. If I have missed any single table/single class references, sorry, and could you point me to them? If not, any suggestions?
Thanks again,
Ken
|