Multiple addJoin with OR
"Ludwig Magnusson" <[email protected]> Mon, 2 Mar 2009 14:03:04 +0100
| Newsgroups | gmane.comp.jakarta.turbine.torque.user |
|---|---|
| Message-ID | <002101c99b37$3cdc31e0$b69495a0$@com> |
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