db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skka...@engr.uky.edu
Subject Re: one-many object mappings
Date Mon, 19 Apr 2004 16:05:51 GMT
Hi,

First I will explain what I understand of your question -
You have an entity X which has many Y refering to it 
through a foreign key in Y. And you want to get all Y's 
that refer to X as a List.

It THAT is what you wanted, there is already one such
function available in Torque. You can do X.getYs() and
it will return a List of all Ys that refer to X. This IS a "s" after the "Y" in 
the function name. You can then do something like this-

List Ylist = X.getYs();
Iterator i = Ylist.iterator();
while (i.hasNext())
{
 Y yobj = (Y) i.next();
 /* Do something in yobj. */
}

Hope this helps.

~Sarav

Quoting Rob Gordon <rgordon@mwt.net>:

> Hi--
> 
> Anyone have any experience with one-many mappings in schema?
> Is it possible?  Basically, I want  something like getBasedOnForeignKey
> to return a List, not a single object.
> 
> Rob
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 




---------------------------------------------------------------------
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