db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: Union of fields
Date Thu, 07 Oct 2004 10:50:39 GMT
Hello,

    You could check a method generated by Torque: doSelectJoin....
this does the same thing, retrieves data from 2 or more tables.
(doSelectJoin... methods are generated in BaseXXPeer when foreign keys 
are defined)
You have to check the code and than write your own code based on
what you see at doSelectJoin.

Best regards,
Andras.


Antonio Iossa wrote:

>Hi all!
>I would like to ask to you a question...
>
>Suppose that my schema is composed by three table: T1(a,b) where a is the
>primary key, T2(c,d) where c is the primary key, and a bridging table
>T1_T2(a,c) because between T1 and T2 there is a many-to-many relation.
>I would perform the following query:
>                                            select T1.a, T1.b, T2.c, T2.d
>                                                        from T1,T1_T2,T2
>                                                                where T1.a =
>T1-T2.a
>
>
>With the Criteria objects, it is possible to code the above query as follow:
>Criteria criteria = new Criteria();
>criteria.addJoin(T1Peer.a,T1_T2Peer.a);
>criteria.addJoin(T1_T2Peer.c, T2Peer.c);
>
>And now??
>Observe that I need the value of fields of BOTH T1 and T2.
>If I wanted only the fields in T2, then I would call the doSelect method as
>follow: List l = T2Peer.doSelect(criteria).
>Concluding, the question is : is it possible perform a query whose resulting
>columns are the union (or a subset of the union) of columns of the tables
>involved  in the query?
>I read the documentation but I didn't find a way to do this.....
>
>Thank you in advance,
>    Antonio Iossa.
>
>
> 
> 
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
> 
> Sponsor:
> Trova e confronta il cellulare piĆ¹ adatto a te! Clicca qui
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2836&d=7-10
>
>---------------------------------------------------------------------
>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