Hello,
> How can I write a criteria that is equivalent to:
>
> SELECT USER_NAME, COUNT(USER_NAME) NUMOFUSERS
> FROM USERTABLE
> WHERE USER_ID = 0000
> GROUP BY USER_NAME;
>> I think it will be something like that in your usertablePeer.java
file
>>
>> criteria = new Criteria();
>> crit.addSelectColumn("COUNT("+ USERNAME+")");
>> crit.add(USER_ID, 0);
>> crit.addGroupByColumn(USER_NAME);
>> List litems = doSelect(crit);
as far as I know, that proposal won't work. As soon as you change the
number of columns to be selected by using "addSelectColumn", the common
"doSelect" method will fail.
The reason is that Torque tries to populate java objects from the raw
select result and needs every and each column as declared in your schema
file.
You will have to use "doSelectVillageRecords", resulting in a list with
"Record" objects, and fill your OM objects by hand. In the case of a
count operation, that shouldn't be a problem.
HTH,
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]