db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Foreign key relationships
Date Thu, 24 Apr 2003 15:49:04 GMT

Weber, Nadja wrote:
> Hi all,
> i have a question regarding usage of foreign key relationships in torque.
> I have a table of elements. Each of those elements has one foreign key reference to another
element (parent element) of the same table, thereby establishing a parent-child-hierarchy.
Now, while it's easy to retrieve the parent, what would i do to retrieve all children of an
element? At the moment i think of writing a select with the criteria set to the parents id,
but is there any other, built-in, functionality in torque that would let me get those relationships?

I don't think Torque generates any methods for getting children. At 
least, Torque hasn't done this for me, so that's my guess. I'm sure you 
could add this, however.

The easiest solution is probably to add such a method to your Element class.


View raw message