It is frequently not quite what is wanted. For instance, I want to find all
orphaned objects, so I need to construct a Criteria that is equivalent to

      WHERE id NOT IN (SELECT id FROM othertable)

and to use this in a doSelect() or doDelete(). I do not want to construct
an SQL statement by hand to retrieve object IDs, and then have to loop
accessing each object.



|---------+---------------------------->
|         |           "GUY Laurent Ext |
|         |           OCISI"           |
|         |           <[EMAIL PROTECTED]|
|         |           elecom.com>      |
|         |                            |
|         |                            |
|         |           13-Jul-2004 09:16|
|         |           Please respond to|
|         |           "Apache Torque   |
|         |           Users List"      |
|         |           <[EMAIL PROTECTED]|
|         |           pache.org>       |
|         |                            |
|---------+---------------------------->
  
>-------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |       To:      "Apache Torque Users List" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]   
                              |
  |                                                                                    
                                     |
  |       cc:                                                                          
                                     |
  |       Subject: RE: need help                                                       
                                     |
  
>-------------------------------------------------------------------------------------------------------------------------|



And what about this method call ?
BasePeer.executeQuery("select count(*) from Table ");

Is it a bad way to do it ?

Laurent


-----Message d'origine-----
De : Henning P. Schmiedehausen [mailto:[EMAIL PROTECTED]
Envoy� : mardi 13 juillet 2004 09:22
� : [EMAIL PROTECTED]
Objet : Re: need help


=?utf-8?B?5b6Q5YGJKFdpbGxpYW0p?= <[EMAIL PROTECTED]> writes:

>Hi ,
>
>Can anybody tell me how  I can implement a "select count(*) from Table "
in Torque ?
>I can not find this in Criteria class using doSelect() , is there other
way to do ?

Criteria crit = new Criteria();
List foo = YourPeer.doSelect(crit);
return foo.size();

Note that this is not exactly efficient. ;-)

             Regards
                         Henning

--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Fighting for one's political stand is an honorable action, but re-
 fusing to acknowledge that there might be weaknesses in one's
 position - in order to identify them so that they can be remedied -
 is a large enough problem with the Open Source movement that it
 deserves to be on this list of the top five problems."
                       -- Michelle Levesque, "Fundamental Issues with
                                    Open Source Software Development"

---------------------------------------------------------------------
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]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to