Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Recursive Tree Problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Recursive Tree Problem..." Watch "Recursive Tree Problem..." New topic
Author

Recursive Tree Problem...

Sanket L Shah
Ranch Hand

Joined: May 08, 2009
Posts: 49

Hi all,

I am developing one application using hibernate and Swing.
I am having one user class.



I have given lazy = "false" in user.cfg.xml. When I run this program using void main... it works well...
now my problem is how can I iterate loop so i can get all the data in tree structure...
I wanted to display the data in Tree Structure... but not able to write correct recursive loop...
Please help me out.....

Thank you so much....


Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Sanket,

What have you tried so far? What comes to mind is iterating over each user and printing out its sub-users recursively, for example:



This assumes there are no cyclical relationships. This may not be exactly what you want, but hopefully it should help get you started.

Jeff


Jeff Storey
Software Developer
[url]http://jeffastorey.blogspot.com[/url]
Sanket L Shah
Ranch Hand

Joined: May 08, 2009
Posts: 49

Hey tha Jeff Storey
MY problem is solved......
Thank you so much....
 
 
subject: Recursive Tree Problem...