-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Parent-Child Single Table, Single Class
PostPosted: Wed Jan 12, 2005 9:23 pm 
Newbie

Joined: Wed Jan 12, 2005 8:17 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.