I don't know any way to have such a select with Torque, but you could probably do it with Two selects :
one for
T1.id_t1= T2.id_t1 AND T2.id_t3 = T3.id_t3
and one for
T1.id_t3 = T3.id_t3
And then the collection of objects you wanted is the "sum" of the 2 collections youn got this way ...
Hope it helps ...
SaM
Cristian Zoicas wrote:
On Thu, 11 Dec 2003, Samuel Le Berrigaud wrote:
You may want to have a look at this page :
http://db.apache.org/torque/peers-howto.html (at the bottom of the page)
the part named "Examples" seems to be what you want ...
SaM
Thank you anyway and without being offensive but the example you pointed ( shown below ) is not exactly the same thing in my opinion.
BEGIN EXAMPLE <<<<
select * from abc where (a < 1 and b > 2) or ( a > 5 and b < 3)
Criteria crit = new Criteria(); Criteria.Criterion a1 = crit.getNewCriterion(ABC.A, 1, Criteria.LESS_THAN); Criteria.Criterion b2 = crit.getNewCriterion(ABC.B, 2, Criteria.GREATER_THAN); Criteria.Criterion a5 = crit.getNewCriterion(ABC.A, 5, Criteria.GREATER_THAN); Criteria.Criterion b3 = crit.getNewCriterion(ABC.B, 3, Criteria.LESS_THAN);
crit.add(a1.and(b2).or(a5.and(b3)));
END EXAMPLE <<<
Here are the reasons:
1. the FROM caluse contains only one table. 2. The getNewCriterion method allows you to add a) a column name b) a value c) a comparison statement between the column name and the value.
and I need a getCriterion which allows me to add : a) a column name; b) a column name; c) a comparison statement between the columns.
Does torque lack such a method or is it possible to do it in another way ?
Cristian Zoicas
Cristian Zoicas wrote:
Hello all
I've tried to figure out how to use the Criteria class in order to obtain a statement like
SELECT * FROM T1, T2, T3 WHERE ( T1.id_t1= T2.id_t1 AND T2.id_t3 = T3.id_t3 ) OR ( T1.id_t3 = T3.id_t3 )
but I was not able to do it. Does anybody has any solution ?
Thank you in advance Cristian Zoicas
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
