Hello Thomas,
I totally agree with you, but still i'm not able to come up with a solution i
would call a good one.
Can you please tell me what i'm doing wrong in the code below:
My current working solution but not considered as a good one:
Criteria criteria = new Criteria();
criteria.add(
KundenadressePeer.KUNDENADRESS_ID,
(Object)"kundenadresse.KUNDENADRESS_ID NOT IN (SELECT
adressenreferenz.KUNDENADRESS_ID FROM
adressenreferenz)",
Criteria.CUSTOM
);
Sort of a "clean" approach, but not working due sql exections:
Criteria subCriteria = new Criteria();
subCriteria.add(AdressenreferenzPeer.KUNDENADRESS_ID, Criteria.ALL);
Criteria criteria = new Criteria();
criteria.add(KundenadressePeer.KUNDEN_ID, kundeId, Criteria.EQUAL);
criteria.addNotIn(KundenadressePeer.KUNDENADRESS_ID,
AdressenreferenzPeer.doSelect(subCriteria));
return KundenadressePeer.doSelect(criteria);
Many thx in Advance,
Jan
-----Ursprüngliche Nachricht-----
Von: Thomas Vandahl [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 19. Oktober 2006 17:52
An: Apache Torque Users List
Betreff: Re: Problems to set up a subquery
Thomas Fischer wrote:
> Hm, writing SQL is one of the the things that Torque wants to avoid.
> One of the reasons for this is portability between databases. Though
> Torque is certainly not perfectly portable, it is much better than plain SQL.
[...]
> So in my eyes, one should think twice before using custom SQL. There
> are cases where it cannot be avoided (see below), but I would think
> twice before using it.
I second that. It is sometimes surprising what *can* be done with the Torque
Criteria. Custom SQL breaks the basic idea of Torque.
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]