Combining Criteria with other than AND
"Oliver Bethge" <[email protected]>
| Newsgroups | gmane.comp.jakarta.turbine.torque.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I try to combine some Criteria with other operators than AND but it seems not possible to me.
Here an example of the SQL I nerly want but it shows the main problems:
SELECT * FROM TABLE1 A, TABLE2 B WHERE A.KEY=B.KEY AND ((B.ORT='ORT1' AND B.PLZ IN (12345,12346)) OR (B.ORT='ORT2' AND B.PLZ IN (12347,12348)) AND NOT (B.OTHER='7' AND B.OTHER2=8)
Combinig Criteria with "AND NOT" looks impossible to me because of line 358ff in org.apache.torque.util.Query:
if (!whereCriteria.isEmpty())
{
stmt.append(WHERE)
.append(StringUtils.join(whereCriteria.iterator(), AND));
}
So all Criteria will be connected by " AND ".
I tryed to use Criteria.CUSTOM but its also not possible to Connect them with " AND NOT ".
Sometimes it schould be possible to get an SQL like
SELECT * FROM TABLE1 A, TABLE2 B WHERE A.KEY=B.KEY AND NOT (B.OTHER='7' AND B.OTHER2=8)
so it is not enougth to get some braces oround the whole WHERE-Clause.
Thanks,
Oliver Bethge