RE: Multiple addJoin with OR

2009-03-09 Thread Ludwig Magnusson
), SqlEnum.CUSTOM); This gave me the result I wanted. Not perfect, but it works. /Ludwig -Original Message- From: Marc Kannegießer [mailto:mac...@gmx.org] Sent: den 2 mars 2009 21:41 To: Apache Torque Users List Subject: Re: Multiple addJoin with OR Ludwig Magnusson wrote: It does make sense. I

Multiple addJoin with OR

2009-03-02 Thread Ludwig Magnusson
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 .

Re: Multiple addJoin with OR

2009-03-02 Thread Hidde Boonstra [Us Media]
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:

RE: Multiple addJoin with OR

2009-03-02 Thread Thomas Fischer
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

RE: Multiple addJoin with OR

2009-03-02 Thread Ludwig Magnusson
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

RE: Multiple addJoin with OR

2009-03-02 Thread Ludwig Magnusson
-Original Message- From: Thomas Fischer [mailto:fisc...@seitenbau.net] Sent: den 2 mars 2009 14:27 To: Apache Torque Users List Subject: RE: Multiple addJoin with OR I want to create an SQLQuery that combines data from three tables. Right now, my javacode looks like

RE: Multiple addJoin with OR

2009-03-02 Thread Thomas Fischer
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 =

RE: Multiple addJoin with OR

2009-03-02 Thread Ludwig Magnusson
-Original Message- From: Thomas Fischer [mailto:fisc...@seitenbau.net] Sent: den 2 mars 2009 14:54 To: Apache Torque Users List Subject: RE: Multiple addJoin with OR I want to create an SQLQuery that combines data from three tables. Right now, my javacode looks like

RE: Multiple addJoin with OR

2009-03-02 Thread Greg Monroe
: Multiple addJoin with OR -Original Message- From: Thomas Fischer [mailto:fisc...@seitenbau.net] Sent: den 2 mars 2009 14:54 To: Apache Torque Users List Subject: RE: Multiple addJoin with OR I want to create an SQLQuery that combines data from three tables. Right now, my

Re: Multiple addJoin with OR

2009-03-02 Thread Thomas Vandahl
Ludwig Magnusson wrote: It does make sense. I rewrote the query by hand (changed AND to OR) and executed it in the MySql console and it gave the response I wanted. I still suspect that this is error prone. I'd be interested in the output of explain. The situation is kind of like this: Table

Re: Multiple addJoin with OR

2009-03-02 Thread Marc Kannegießer
Ludwig Magnusson wrote: It does make sense. I rewrote the query by hand (changed AND to OR) and executed it in the MySql console and it gave the response I wanted. The situation is kind of like this: Table a is a category table, it only contains ids and names of categories. Table B is a