Re: Combining Criteria with other than AND

Patrick Carl <[email protected]>
Newsgroups gmane.comp.jakarta.turbine.torque.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Have a look at
http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-db.html
Section "AND and OR operators"

Patrick

Oliver Bethge schrieb:
| 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
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [email protected]
| For additional commands, e-mail: [email protected]
|

- --
Patrick Carl
mailto:[email protected]                                http://carl.it
GnuPG-Fingerprint: 3599 02CF 0419 BCA6 6BAC 4B53 DB7C 1897 451C F498
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIFe1r23wYl0Uc9JgRAnmyAJ46izaiyVwfwCnlq4XJR3Pl0lp3ngCfXH9k
2rmB6Gtj3evFloLaJYkqLl8=
=A77S
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.