-->
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: Turning a denormalized table into a tree structure
PostPosted: Fri Dec 01, 2006 6:15 pm 
Newbie

Joined: Mon May 08, 2006 5:25 pm
Posts: 3
I have a flat legacy table that has been denormalized and I would like to create a tree data structure from it. Is it possible to do this through hibernate?

The table has the following columns

segmentid - primary key
groupid
sectionid

and I would like to represent the data as a tree where sectionid is the root node, then groupids, finally segmentids are the leaves. Is there a way to describe this through the a hibernate mapping file.

Thank you for your time.
-Fazle


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 7:54 pm 
Beginner
Beginner

Joined: Tue May 23, 2006 4:10 pm
Posts: 38
Location: Charleston, SC
Yes, you can easily represent tree structures with hibenate. If what you want is a section with one or more groups with each group having one or more segments then create 3 POJOs: Section, Group, and Segment. Link Section and Group with a one-to-many association and link Group to Segment with a one-to-many association. I'll leave the implementation to you.

Grant


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.