jtree population from database
Posted on 2003-11-17
I am trying to build a swing app that loads data into a tree from an oracle database.
The problem seems to be that I can't retrieve all the rows and just build the tree because of the large possibility of a tremendous amount of records. Instead I thought that I should only initially populate the root nodes and when the user clicks to expand, retrieve the children of that node...and when the node is closed again, clear those objects -- or release the memory somehow.
My problem is I have no knowledge of how to do such a thing and from my searches, there isn't much documentation of an acutal database implementation of populating a jtree and definitiely none regarding dynamic loading / unloading.
So my question (and I'm willing to give away all my points for as much help as possible with this), how can I create a jtree that loads dynamically based on 1) first load (just load root nodes) or 2) clicking on node (load children based on parent value).
Table setup example:
ID //never 0 -- auto increment with each record
ParentID // references ID -- 0 is root.
Date // Just other values that will
Time // be loaded in Value Object
Any help I would appreciate!