db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saravana Krishnan <saravkr...@uky.edu>
Subject Join or Caching (??)
Date Tue, 16 Nov 2004 06:47:23 GMT
Hi,

  I have 3 tables A, B and C. A has a one-to-many relationship with B
_and_ C. B has a one-to-many relationship with itself _and_ C.

For example (ASCII art tree - fixed width font will help) the following
is a valid tree that I'm trying to represent with the tables A, B and C-

       A
       |
   +---+---+
   |   |   |
   B   B   C
   | 
 +---+
 |   | 
 B   C
 |
+-+
| |
C C

 As of now, I use A.getBs(), A.getCs(), B.getBs() (I wrote this in
B.java) and B.getCs() functions to get the tree recursively and create
another object tree consisting of objects XA, XB and XC which are direct
mappings of A, B and C. So for a single tree, Torque does several
queries to read in all the nodes. Is there a way to read in the whole
tree? May be using some kinda JOIN?

 Another idea I had, which assumes Torque does some kinda caching is,
relate all the nodes of a single tree to a particular TreeObj. I can
then do something like Tree.getAs(), Tree.getBs() and Tree.getCs(). Then
I will do the same recursive querying as mentioned in the above para and
the caching will limit the total queries for a tree to 3 (one each for
all the As, Bs and Cs) instead of n (where n is the number of non-leaf
nodes). So, does torque do any kind of caching?

Thanks in advance,
Sarav


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message