db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludwig Magnusson" <lud...@itcatapult.com>
Subject Multiple addJoin with OR
Date Mon, 02 Mar 2009 13:03:04 GMT
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

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message