db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ron piterman <ron.piter...@gmx.net>
Subject Re: Criteria parses to "SELECT FROM .."
Date Wed, 14 Jul 2004 09:25:16 GMT
Thanx... I will try it.

Göschl,Siegfried wrote:

>Hi Thomas,
>
>A good approach is to use P6Spy to trace ALL SQL statements generated by Torque
>
>Cheers,
>
>Siegfried Goeschl
>
>-----Original Message-----
>From: Thomas Fischer [mailto:Fischer@seitenbau.net] 
>Sent: Mittwoch, 14. Juli 2004 11:00
>To: Apache Torque Users List
>Subject: RE: Criteria parses to "SELECT FROM .."
>
>
>
>
>
>
>
>Hi Ron,
>
>I guess the point is that in every Peer class for a database table, in the method doSelectVillageRecords(Criteria
criteria, Connection con) which is called from the usual doSelect(criteria), the following
call is made BEFORE the criteria is converted to a query:
>
>        if (criteria.getSelectColumns().size() == 0)
>        {
>            addSelectColumns(criteria);
>        }
>
>This explains why you dont see any select columns if you print the query before you call
the doSelectMethod. So adding System.out.println(createQueryString(c));
>AFTER calling doSelect should print the correct Columns...
>
>There are more pitfalls like this if you use createQueryString() yourself, so if you want
to know which Query is actually executed is the Torque Debug log !!!
>
>  
>
>>>       c.add(CATEGORIES_ID, id);
>>>       c.add(LANGUAGE_ID, language.getLanguagesId());
>>>       try {
>>>           System.out.println(createQueryString(c));
>>>           return  doSelect(c);
>>>       }
>>>       catch (TorqueException ex) {
>>>           ex.printStackTrace();
>>>           return EMPTY;
>>>       }
>>>      
>>>
>
>I do not see any error in this code. What exactly happens if you execite the code ?
>
>    Hope that helps,
>
>          Thomas
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message