-->
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: Persistent Tree-Structure
PostPosted: Thu Aug 21, 2008 9:26 am 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
Hi,

i need some help with managing a persistent tree-structure. mainly it will be used in a user-interface to display hierarchically the stored data

i have allready a solution on the database-side that fits my needs:

tables:
TreeIndex -> an index of my different trees
node, node-relations -> there can be bidirectional n:m relations between the nodes
node-type -> e.g. this node is a country-node and it childs are cities
data-item, data-item-type -> can be attached to a node e.g. the number of inhabitants of a city

now i tried to implement a working services to manage my different trees but its gotten very unhandy and ugly. particularly doing changes to an existing tree seems very troublesome.

anyone knows some reading/books about managing tree-structures with ORM (Hibernate would be great ;) )


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 21, 2008 10:25 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
What you describe could be way more easily done by two classes (and matching tables):

Country

City

with the 1:n relationship from Countries to cities.

Everything is straight forward.

So why are you trying to do this weired table design?

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 21, 2008 12:50 pm 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
country and city are only examples.

this tree-structure is needed by at least 3 data-collections (sorry for my bad english ;) ):

- address-data (for at least 2 countries with totaly different structures and today we dont know if tomorrow a structure for a new country like switzerland is needed)
- age
- interest of users

and in the future there might be some more.. so its desirable to keep things generic (or at least to try as hard as i can to do so).

//edit:
in another forum they showed me a way to avoid this n:m rellation. maybe that would make things easier. still it would be nice to have some readings or so :)


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.