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.  [ 3 posts ] 
Author Message
 Post subject: Parent/Child relationship on the same table
PostPosted: Wed Jun 01, 2005 4:19 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:31 am
Posts: 42
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

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:


Hello all,
@work i have a table that contains 'containers' of different type..
EAch container is contained in other containers in the same table, and i was wondering if it was possible to have a parent/child relationship on the same table with hibernate..
Is that possible?
any tips on how to proceed?

thanx in advance and regards
marco


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 11:46 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Yes - perfectly possible.
Just map a on-to-many relationship back to the same table.
One tip - the parent key is going to have to be nullable since you are going to get to the top level container at some stage.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 08, 2006 3:19 am 
Newbie

Joined: Tue Feb 21, 2006 5:13 am
Posts: 2
I'm also expecting the same. Any samples available for this, along with any specific limitation with this approach ?


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

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.