torque-user

[Prev] Thread [Next]  |  [Prev] Date [Next]

RE: Multiple addJoin with OR Ludwig Magnusson Mon Mar 02 07:01:48 2009

I thougt of that as well and it generates a InvocationTargetException that has 
a NullPointerException. I ran it through a debug but could not find the source..

-----Original Message-----
From: Hidde Boonstra [Us Media] [mailto:[EMAIL PROTECTED] 
Sent: den 2 mars 2009 14:18
To: Apache Torque Users List
Subject: Re: Multiple addJoin with OR

Hi Ludwig,

never done that, but I would suppose you could use criteria.getNewCriterion and 
use the SqlEnum.JOIN as your comparison. Than use criteria.criterion.or to 
create an or between the two.

See:

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.html

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/SqlEnum.html

http://db.apache.org/torque/releases/torque-3.3/runtime/apidocs/org/apache/torque/util/Criteria.Criterion.html

Regards,

Hidde.

----- "Ludwig Magnusson" <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> I want to create an SQLQuery that combines data from three tables.
> Right
> now, my javacode looks like this:
> 
> Criteria.addJoin(TableA.id, TableB.fk);
> 
> Criteria.addJoin(TableA.id, TableC.fk);
> 
>  
> 
> This results in this SQL query: 
> 
> .
> 
> WHERE TableA.id = TableB.fk 
> 
> AND TableA.id = TableC.fk
> 
> .
> 
>  
> 
> However, this is not the result I need. What I need is a query with
> OR
> instead of AND, like this:
> 
> .
> 
> WHERE TableA.id = TableB.fk 
> 
> OR TableA.id = TableC.fk
> 
> .
> 
>  
> 
> I haven't found any way to do this using criteria. Is it possible?
> 
> /Ludwig

-- 
Hidde Boonstra
Us Media B.V.
Stadhouderskade 115
1073 AX Amsterdam

t: 020 428 68 68
f: 020 470 69 05
www.usmedia.nl

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