I have tree-like data structure in DB and i want to represent it through JSP/EJB in many pages. Something similar to forum threads.
Is there any optimized solution for it? (Caching pages or something similar)
Thanks in advance,
As you have said the project is to put the data in more of forum type of thing I am not sure if caching will help in this problem. Generally caching is used for static data which needs to be frequently accessed. In your case the fellow might start with any strand and want to pull the whole mesh attached to it.
My suggestiong will be to write a real strong SQL with proper joins. I had this kind of problem in on of the project where I had to pull all the domain network from a single root domain node. our dba cameup with real good query the only thing what we did was we added a virtual column in query where it use to give us the level of the node in the tree. and one more column was keeping track of the immd parent for the node.
hope this helps
Thanks Chetan for the idea.
I'm not sure that i'll be able to do it. I used forums just as an example. I deal with heavy CMP entity beans stored in cache (commit option A). (Using CMP saved me a lot of time).
Problem is that often i have to traverse the tree from a particular node (to get all of its parents). Accessing CMR relationships in different order causes frequent deadlock.
May be i'll be able to apply your idea with EJB-QL.