db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Spiegel" <spie...@szwo.de>
Subject Joins in torque
Date Thu, 19 Jan 2006 16:17:29 GMT
Hi, (in case this message is double please excuse me)

I really do not understand what to do, I do not get the expected results!

Let´s say I have 3 Tables: T1, T2 and T1_2
T1:
ID (integer pk)
value (varchar)
...

T2:
ID (integer pk)
value (varchar)
...

T1_2:
T1_ID (integer fk->T1)
T2_ID (integer fk->T2)

As a result, I would like to have a union table showing the values of T1 and
T2
in SQL this would be: select T1.value, T2.value from T1, T2, T1_2 where
T1.ID = T1_2.T1_ID and T2.ID = T1_2.T2_ID

if I get more than this (select * ...) would be fine as well.

So, I have my classes but when I try to use them as written in Peers HowTo
(doSelectJoin...) or in Criteria HowTo (crit.addJoin(...)) I always get only
the values of the T1_2-table

As a first step, I try just to get the first half (result should show:
T1.value, T1_2.T2_ID)
so it should correspond to:
doSelectJoinT1(crit) in T1_2Peer
or:
crit.addJoin(T1.ID,T1_2.T1_ID,Criteria.LEFT_JOIN)

as a result I just get the T1_2 values. I checked the mailing-list-archives,
I can´t find a helpful message. Where is my mistake? Could somebody tell me
exactly how to add this join?

(I´m using torque-3.2, MySQL 5, defaultidMethod=native)

thanks in advance, Stephan



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