This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Composite like relationship - Mapping Question

 
Varun Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 tables - Component and ComponentTree.
Component is the master table for each component - whether parent or child. ComponentTree is parent-child relationship table (one to many).

for example:

Component Records:

componnent1, Parent Component
componnent2, Child Component
componnent3, Child Component


ComponentTree Records:

componnent1, component2
componnent1, component3


I have defined a single class



Since there is only one class 'Component', I am confused about associating children components to parent component in writing getBaseChildren() method.
Can someone help?


 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Varun, you could use this code below,



regards,
 
Varun Chopra
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks but where do I specify that children are in COMPONENTTREE table, not in COMPONENT.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic