You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Martin Tilsted <ti...@daimi.au.dk> on 2008/02/18 19:14:22 UTC

How do I control the join type of doSelectJoin?

How do I control the join type of the  doSelectJoin methods?

Currently it use the "join which are not real joins, and which don't use 
the join keywoard".
That is: The joins where it just set the fields values  of the 2 
relations to be equal. (The default join operation for some reason)
 I don't know what that kind of joins are called, so let me just call 
them field joins.

The problem with field joins are that if you use more then one in a 
single query you get duplicate rows in your result,
so what do I do if i have a criteria which in itself contains 2 inner 
joins, and I also need to use the doSelectJoin method?
I can't convert it to field joins, because that will give me duplicate rows.

btw: I have newer understood the reason to use field joins at all. Can 
anyone enlighten me on in which cases one would use a field join
instead of a inner join?

Martin


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


Re: How do I control the join type of doSelectJoin?

Posted by Martin Tilsted <ti...@daimi.au.dk>.
Thomas Fischer wrote:
>> btw: I have newer understood the reason to use field joins at all. 
> Can anyone
>> enlighten me on in which cases one would use a field join
>> instead of a inner join?
>>
>
> Hm, in most databases (e.g. mysql, oracle, postgresql) the thing you 
> call "field join" is an inner join (just a different syntax) so you 
> already got what you wanted.
>
>> The problem with field joins are that if you use more then one in a 
>> single
>> query you get duplicate rows in your result,
>
> This is not true in general. Could you give an example where this 
> happens ?
Not a valid one. I was wrong about the joins, it does work exactly 
like(Is a) inner join, so you were right. There is not really a problem.

Martin






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


Re: How do I control the join type of doSelectJoin?

Posted by Thomas Fischer <tf...@apache.org>.
> btw: I have newer understood the reason to use field joins at all. 
Can anyone
> enlighten me on in which cases one would use a field join
> instead of a inner join?
>

Hm, in most databases (e.g. mysql, oracle, postgresql) the thing you call 
"field join" is an inner join (just a different syntax) so you already got 
what you wanted.

> The problem with field joins are that if you use more then one in a single
> query you get duplicate rows in your result,

This is not true in general. Could you give an example where this happens 
?

As for the answer in the headline: Currently the two ways I can think of 
to change the join type (e.g. to an outer join) is to duplicate the code 
do doSelectJoin with another join type manually; or you can manipulate the 
Torque templates.

    Thomas

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