-->
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.  [ 2 posts ] 
Author Message
 Post subject: A particular Tree (a Graph)
PostPosted: Sun Jan 28, 2007 2:02 pm 
Newbie

Joined: Sun Jan 14, 2007 8:01 am
Posts: 2
Hi all!

I'd like to know how would you design a graph with Hibernate. Let me explain...

I have one class, Technology. This class has parents and childs (other Technology classes) to form a graph (i.e. a tree with nodes that have more than one parent). I'd like to navigate through this graph upside-down and bottom-up.

I have thought of two many-to-many relationships (parents and childs), but setting the inverse attribute I stopped. It seems to me that something's wrong. How can I choose an inverse=true end inside the same class types?

Is there a better and clever way to accomplish this?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 28, 2007 5:26 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You say that there's a fixed orientation, a definite "top" and "bottom". So you'll have two many-to-many collections, getChildren inverse="false" and getParents inverse="true". Don't cascade-delete: do "collection.remove(x); session.delete(x);" when you know that object x needs to be completely deleted.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.