Re: How to check if row exists or retrieve last inserted id after insert when using Torque OM?

2006-10-20 Thread Thomas Vandahl
David Zhao wrote: Hi there, How do I either check if a certain record exists in the table using Torque OM class, or insert a new record, and retrieve the last_inserted_id? Thanks, 1.) There are two ways. Either you set up a Criteria object containing the primary key (see the

AW: Problems to set up a subquery

2006-10-20 Thread Pfiester, Jan
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();

AW: Problems to set up a subquery

2006-10-20 Thread Thoralf Rickert
Sort of a clean approach, but not working due sql exections: [...] criteria.addNotIn(KundenadressePeer.KUNDENADRESS_ID, AdressenreferenzPeer.doSelect(subCriteria)); [...] Just a question because I'm not sure if you just show an example or the real code, that you're using. The

AW: Problems to set up a subquery

2006-10-20 Thread Pfiester, Jan
Well, it is some real code... Did you overwrite the toString() method in Adressreferenz? No, I did'nt. but my Torque version (3.2) uses toString() to create the query. The generated toString() method in BaseAdressreferenz is nice for debugging but useless for sql-queries... So what are

Re: AW: Problems to set up a subquery

2006-10-20 Thread Thomas Vandahl
Pfiester, Jan wrote: 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 =

AW: Problems to set up a subquery

2006-10-20 Thread Thoralf Rickert
You have three options: Overwrite toString and return the KundenaddressId that is set in the reference (because that is what you want). The other solution is to make a doSelectVillageRecords (that returns only the columns that you have ask for with subCriteria.addSelectColumn()). The

AW: AW: Problems to set up a subquery

2006-10-20 Thread Pfiester, Jan
Thx for that one, I've try your latest hint too, but i didn't know that you can check zero references like you did! criteria.add(AdressenreferenzPeer.KUNDENADRESS_ID, ??0??, Criteria.ISNULL); In your criteria what is the second param in the signature doing? What is the 0 indicating?

AW: Problems to set up a subquery

2006-10-20 Thread Pfiester, Jan
Many thx! As i've just stated, i had tried to do it by using an outer join at first too, but i did'nt know how to eliminate the intersection of both tables in the result set... -Ursprüngliche Nachricht- Von: Thoralf Rickert [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 20. Oktober 2006

Torque and MS Access via odbc

2006-10-20 Thread [EMAIL PROTECTED]
Hi all, I’m having troubles using torque to connect to a MS Access database via jdbcodbc driver. I managed to create the java classes for this db, using the command ant –f build-access.xml The problems arise qhen I use either ant –f build-access.xml create-db or ant –f build-access.xml

Re: AW: AW: Problems to set up a subquery

2006-10-20 Thread Thomas Vandahl
Pfiester, Jan wrote: Thx for that one, I've try your latest hint too, but i didn't know that you can check zero references like you did! criteria.add(AdressenreferenzPeer.KUNDENADRESS_ID, ??0??, Criteria.ISNULL); In your criteria what is the second param in the signature doing?